C Program to Compute Volume and Surface Area of Cube
Write C Program to Compute the Volume and the Surface Area of a Cube
//Write a C Program to Compute Volume and Surface Area of Cube
#include <stdio.h>
int main()
{
float side = 4;
double area_cube;
//cube area formula
area_cube = 6 * side * side;
double volume;
//cube volume formula
volume = side * side * side;
printf("Surface area of the cube having side %.2f :--> %0.2f ", side, area_cube);
printf("\nVolume of the cube having side %.2f :--> %.2f ",side, volume);
return 0;
}
Output:
Surface area of the cube having side 4.00 :--> 96.00
Volume of the cube having side 4.00 :--> 64.00