C program to compute the surface area and volume of a cube

by Nideesh C on April 12, 2011 · 0 comments

in C Programming




/* 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 llngth 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
——————————————*/

Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C program to find the area of a circle, given the radius
  2. C program to find the area of a triangle, given three sides
  3. C program to read a string and check whether it is a palindrome or not (without using library functions). Output the given string along with suitable message.
  4. C program to read N names, store them in the form of an array and sort them in alphabetical order. Output the give names and the sorted names in two columns side by side with suitable heading
  5. Sample – Program to compute the fibonacci series.

Leave a Comment

Previous post:

Next post: