1. Accept dimensions of a cylinder and print the surface area and volume (Hint: surface area =
2pr2 + 2prh, volume = pr2h)

#include<stdio.h>
#include<conio.h>

void main()
{
 float r,h,sa,v;
 clrscr();

 printf("\nFinding Surface Area of cylinder and volume:");
 printf("\nEnter the radius of cylinder in cm:");
 scanf("%f",&r);
 printf("\nEnter the height of cylinder in cm:");
 scanf("%f",&h);

 sa=(2*3.14*r*r)+(2*3.14*r*h);
 printf("\nSurface area of cylinder:%f",sa);

 v=3.14*r*r*h;
 printf("\nvolum of Cylinder:%f",v);

 getch();
}
/*
output:

Finding Surface Area of cylinder and volume:                                   
Enter the radius of cylinder in cm:3                                           
                                                                               
Enter the height of cylinder in cm:3                                           

Surface area of cylinder:113.040001
volum of Cylinder       :84.779999
*/

No comments:

Post a Comment

Questions

  Exercise 1 Set A . Apply all the three program development steps for the following examples.  1. Accept dimensions of a cylinder and p...