Loading...

Calculate Surface Area and Volume of a Cube

Programme:

#include <stdio.h>
#include <math.h>
 
void main()
{
    float side, surfacearea, volume;
 
    printf("Enter the length of a side :\n");
    scanf("%f", &side);
    surfacearea = 6.0 * side * side;
    volume = pow(side, 3);
    printf("Surface area = %6.2f and Volume = %6.2f \n", surfacearea, volume);
}

Output:

Enter the length of a side :                                                                                                
5                                                                                                                           
Surface area = 150.00 and Volume = 125.00