Thursday, 16 November 2017

C Program to Compute the Surface Area & Volume of a Cube


Code:

#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
34
Surface area = 6936.00 and Volume = 39304.00


More C Programs:













100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...