C PROGRAM TO COMPUTE THE SURFACE AREA AND VOLUME OF THE CUBE

/*   Write a c program to compute the surface area and volume of a cube  */

#include <stdio.h>
#include <math.h>

void main()
{
float  side, surfArea, volume;

printf(“Enter the length of a side\n”);
scanf(“%f”, &side);

surfArea = 6.0 * side * side;

volume = pow (side, 3);

printf(“Surface area = %6.2f and Volume = %6.2f\n”, surfArea, volume);
}

/*——————————————
Output
Enter the length of a side
4
Surface area =  96.00 and Volume =  64.00

RUN2
Enter the length of a side
12.5
Surface area = 937.50 and Volume = 1953.12
——————————————*/

ilook website

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.