In this article we will show you, How to write C Program to find Volume and Surface Area of a Cube with example. Before we step into the program, Let see the definitions and formulas behind Surface area of a Cube and Volume of a Cube

## CUBE

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

### Surface Area of a Cube

If we know the length of any 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 is 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)

**Volume of a Cube**

The amount of space inside the Cube is called as Volume. If we know the length of any edge of a Cube then we can calculate the Volume of Cube using 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 user to enter any side of a Cube. Using this value, this program will calculate 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; }

**OUTPUT**

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 example we got Surface area = 150 when the length = 5. Let us do the reverse approach (I mean 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

Thank You for Visiting Our Blog