C Program to Find Volume and Surface Area of a Cone

In this tutorial, i am going to show you how to find volume and surface area of a Cone with the help of standard formula and function in c programs.

All C Programs to Find Volume and Surface Area of a Cone

  • C Program to Find Volume and Surface Area of a Cone using Standard Formula
  • C Program to Find Volume and Surface Area of a Cone using Function

C Program to Find Volume and Surface Area of a Cone using Standard Formula

/* C Program to find Volume and Surface Area of a Cone */
#include <stdio.h>
#include <math.h>
int main()
{
  float radius, height;
  float Volume, SA, l, LSA;
  
  printf("\n Please Enter Radius of a Cone :- ");
  scanf("%f", &radius);
  
  printf("\n Please Enter Height of a Cone :- ");
  scanf("%f", &height);
  l = sqrt(radius * radius + height * height);
  SA = M_PI * radius * (radius + l);
  Volume = (1.0/3) * M_PI * radius * radius * height;
  LSA = M_PI * radius * l;
  printf("\n Length of a Side (Slant)of a Cone = %.2f", l);    
  printf("\n Surface Area of a Cone = %.2f", SA);
  printf("\n Volume of a Cone = %.2f", Volume);
  printf("\n Lateral Surface Area of a Cone = %.2f", LSA);
  return 0;
}

The result of the above c program; as follows:

Please Enter Radius of a Cone :- 10
Please Enter Height of a Cone :- 6
Length of a Side (Slant)of a Cone = 11.66
 Surface Area of a Cone = 680.53
 Volume of a Cone = 628.32
 Lateral Surface Area of a Cone = 366.37

C Program to Find Volume and Surface Area of a Cone using Function

/* C Program to find Volume and Surface Area of a Cone */
#include <stdio.h>
#include <math.h>
float VolSurCONE(float radius,float height)
{
  float Volume, SA, l, LSA;
  l = sqrt(radius * radius + height * height);
  SA = M_PI * radius * (radius + l);
  Volume = (1.0/3) * M_PI * radius * radius * height;
  LSA = M_PI * radius * l;
  printf("\n Length of a Side (Slant)of a Cone = %.2f", l);    
  printf("\n Surface Area of a Cone = %.2f", SA);
  printf("\n Volume of a Cone = %.2f", Volume);
  printf("\n Lateral Surface Area of a Cone = %.2f", LSA);
}
int main()
{
  float radius, height;
  
  printf("\n Please Enter Radius of a Cone :- ");
  scanf("%f", &radius);
  
  printf("\n Please Enter Height of a Cone :- ");
  scanf("%f", &height);
  VolSurCONE(radius,height);
  return 0;
}

The result of the above c program; as follows:

Please Enter Radius of a Cone :- 5
Please Enter Height of a Cone :- 5
Length of a Side (Slant)of a Cone = 7.07
 Surface Area of a Cone = 189.61
 Volume of a Cone = 130.90
 Lateral Surface Area of a Cone = 111.07

More C Programming Tutorials

Be First to Comment

Leave a Reply

Your email address will not be published.