Google analytics

Saturday, August 27, 2011

Area and volume of cone

/* Area & volume of Cone */

#include<stdio.h>
#include<math.h>
int
 main()
{  

     float r,h;
    
 float surface_area,volume;
       printf("Enter size of radius and height of a cone : ");
       scanf("%f%f",&r,&h);
     surface_area = M_PI * r * (r + sqrt(r*r + h*h));
      
volume = (1.0/3) * M_PI * r * r * h;
        printf("Surface area of cone is: %.3f",surface_area);
        printf("\nVolume of cone is : %.3f",volume);
    
 return 
0;
}

No comments:

Post a Comment