Saturday, 16 July 2011

Write a c program to find the volume and surface area of a cube






C
program for area of a cube








Formula of surface
area of cube:

Surface_area = 6 * a2



Formula of volume
of cube:

Volume = a3



C code:



#include



int main(){



    float a;

    float
surface_area,volume;



    printf("Enter
size of any side of a cube : ");

    scanf("%f",&a);



    surface_area
= 6 * (a * a);

    volume
= a * a * a;



    printf("Surface
area

No comments:

Post a Comment