How to write C Program to find Volume and Surface Area of a Cuboid with example. Before we step into the C Program to find Volume and Surface Area of a Cuboid, Let see the definitions and formulas behind the Surface area of a Cuboid, Area of Top & Bottom Surfaces, Lateral Surface Area and Volume of a Cuboid

## C Cuboid

A cuboid is a 3D object made up of 6 Rectangles. All the opposite faces (i.e., Top and Bottom) are equal.

### C Surface Area of a Cuboid

The Total Surface Area of a Cuboid is the sum of all the 6 rectangles areas present in the Cuboid. If we know the length, width, and height of the Cuboid then we can calculate the Total Surface Area using the formula:

- Area of Top & Bottom Surfaces = lw + lw = 2lw
- Area of Front & Back Surfaces = lh + lh = 2lh
- Area of both sides = wh + wh = 2wh

The Total Surface Area of a Cuboid is the sum of all the 6 faces. So, we have to add all these areas to calculate the final Surface Area

- Total Surface Area of a Cuboid = 2lw + 2lh + 2wh
- It is equal: Total Surface Area = 2 (lw + lh +wh)

### C Volume of a Cuboid

The amount of space inside the Cuboid called Volume. If we know the length, width, and height of the Cuboid then we can calculate the volume using the formula:

- Volume of a Cuboid = Length * Breadth * Height
- Volume of a Cuboid = lbh
- The Lateral Surface Area of a Cuboid = 2h (l + w)

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

This C program allows the user to enter the length, width, and height of a Cuboid. By using these values, the C program will calculate the Surface Area, Volume, and Lateral Surface Area of Cuboid as per the formulas.

/* C Program to find Volume and Surface Area of a Cuboid */ #include <stdio.h> int main() { float length, width, height; float SA, Volume, LSA; printf("\nPlease Enter Length, Width and Height of a Cuboid\n"); scanf("%f %f %f",&length, &width, &height); SA = 2 * (length * width + length * height + width * height); Volume = length * width * height; LSA = 2 * height * (length + width); printf("\n The Surface Area of a Cuboid = %.2f\n",SA); printf("\n The Volume of a Cuboid = %.2f\n",Volume); printf("\n The Lateral Surface Area of a Cuboid = %.2f\n",LSA); return 0; }

**OUTPUT**

**ANALYSIS**

In the above C program to find Volume and Surface Area of a Cuboid Example, We inserted Values Length = 8, Width = 5 and Height = 6

The Volume of a Cuboid in C for the Given Measures are:

Volume of a Cuboid = lbh = l * w * h

Volume of a Cuboid = length * width * height

Volume of a Cuboid = 8 * 5 * 6

Volume of a Cuboid = 240

The Volume of a Cuboid is 240

The Total Surface Area of a Cuboid for the Given Measures in C Programming are:

Total Surface Area of a Cuboid = 2lw + 2lh + 2wh

Total Surface Area of a Cuboid = 2 (lw + lh +wh)

Total Surface Area of a Cuboid = 2*(length * width + length * height + width * height)

Total Surface Area of a Cuboid = 2 * ( (8 * 5) + (8 * 6) + (5 * 6) )

Total Surface Area of a Cuboid = 2 * (40 + 48 + 30)

Total Surface Area of a Cuboid = 2 * 118

Total Surface Area of a Cuboid = 236

The Total Surface Area of a Cuboid is 236

The Lateral Surface Area of a Cuboid for the Given Measures in C are:

Lateral Surface Area of a Cuboid = 2lh + 2wh

Lateral Surface Area of a Cuboid = 2h (l + w)

Lateral Surface Area of a Cuboid = 2 * height * (length + width)

Lateral Surface Area of a Cuboid = 2 * 6 * (8 + 5)

Lateral Surface Area of a Cuboid = 2 * 6 * (13 )

Lateral Surface Area of a Cuboid = 156

The Lateral Surface Area of a Cuboid is 156