C Program to Compute Volume and Surface Area of Cuboid
C Program to Compute the Volume and Surface Area of the Cuboid
//Write a C Program to Compute Volume and Surface Area of Cuboid
#include <stdio.h>
int main()
{
float length = 4, breadth = 5, height = 6 ;
double area_cuboid;
//cuboid area formula
area_cuboid = 2 * ((length * breadth) + (breadth * height) + (height * length));
double volume;
//cuboid volume formula
volume = length * breadth * height;
printf("Surface area of the cuboid having length %.2f, breadth %.2f and height %.2f is --> %0.2f ", length, breadth, height, area_cuboid);
printf("\nVolume of the cuboid having length %.2f, breadth %.2f and height %.2f is --> %0.2f ", length, breadth, height, volume);
return 0;
}
Output:
Surface area of the cuboid having length 4.00, breadth 5.00 and height 6.00 is --> 148.00
Volume of the cuboid having length 4.00 breadth 5.00 and height 6.00 is --> 120.00