How to write C Program to find Volume and Surface Area of a Cube with example?. Before we step into the C Program to find Volume and Surface Area of a Cube, Let see the definitions and formulas behind the Surface area of a Cube and Volume of a Cube.

## C CUBE

All the edges in the Cube have the same length. We can say, Cube is nothing but six equal squares.

### C Surface Area of a Cube

If we know the length of an edge in Cube, then we can calculate the surface area of a Cube using the formula:

- Surface Area of a Cube = 6l² (Where l is the length of any side of a Cube).
- Area of a square = l² Since the Cube made of 6 equal squares, Surface Area of a Cube = 6l²

If we already know the Surface Area of Cube and then we can calculate the length of any side by altering the above formula as:

- l = √sa / 6 (sa = Surface Area of a Cube)

**The Volume of a Cube in C**

The amount of space inside the Cube called Volume. If we know the length of any edge of a Cube then we can calculate the Volume of Cube using the formula:

- Volume = l * l * l
- The Lateral Surface Area of a Cube = 4 * (l * l)

## C Program to find Volume and Surface Area of a Cube

This C program allows the user to enter any side of a Cube. By using this value, this C program will find the Surface Area of a cube, Volume of a cube, and Lateral Surface Area of a Cube as per the formulas.

/* C Program to find Volume and Surface Area of a Cube */ #include int main() { float l, SA,Volume, LSA; printf("\n Please Enter Length of any side of a Cube \n"); scanf(" %f ", &l); SA = 6 * (l * l); Volume = l * l * l; LSA = 4 * (l * l); printf("\n Surface Area of Cube = %.2f", SA); printf("\n Volume of cube = %.2f", Volume); printf("\n Lateral Surface Area of Cube = %.2f", LSA); return 0; }

In this C program, We entered the Length of any side of a Cube = 5

The **Surface Area of a Cube** is

Surface Area of a cube = 6 * length * length

Surface Area of a cube = 6 * 5 * 5

Surface Area of a cube = 150

The **Volume of a Cube** is

Volume of a cube = length * length * length

Volume of a cube = 5 * 5 * 5;

Volume of a cube = 125

The **Lateral Surface Area of a Cube** is

Lateral Surface Area of a cube = 4 * length * length

Lateral Surface Area of a cube = 4 * 5 * 5

Lateral Surface Area of a cube = 100

In the above C Programming example, we got the Surface area of a cube = 150 when the length = 5. Let us make the reverse approach (calculate the length of a Cube using Surface Area = 150)

Length of a cube = √sa / 6

Length of a cube = √150 / 6

Length of a cube = √25

Length of a cube = 5