C Program to Calculate Volume and Total Surface Area of Cone

  • Write a C program to find volume of a cone.
  • Write a C program to find total surface area of a cone.

A cone is an three-dimensional geometric shape having circular base and only one vertex. A cone can be formed by the locus of all straight line segments that join the vertex to the base has a rotational symmetry. We can say that a cone have flat circular base and having one side curved surface. The volume and the total surface area of the cone depend upon the radius of base, height and slant height of the cone.

  • Radius : It is the radius of the circular base of cone.
  • Height : It is the perpendicular distance between the vertex and the circular base of cone.
  • Slant Height : It is the length of line segment joining vertex to a point on the base circumference. If we know the radius and height of a cone then slant height can be calculates as sqrt(R2 + H2) where, R is the radius of base and H is the height of the cone.
  • Axis : It is a straight line which joins the vertex of the cone and the center of the circular base.

Here, we are discussing about right circular cone, means the base of the cone is circular and the axis of the cone is perpendicular to base.

Volume of Cone
The volume of a cone can be defined as the amount of three dimensional space occupied by the right circular cone or the storage capacity of a right circular cone. Finding volume of a cone help us to solve many real life problems like, how much ice-cream is required to file an ice-cream cone. To calculate the volume of a right circular cone, we need radius of base height of cone. Volume of a cone is measured in cubic units like meter3, cm3 etc.
Volume of right circular cone = (Base area x Height)/3;
As base of cone is circular, Base Area = ΠR2
Then,
Volume of right circular cone = (ΠR2H)/3
Where ‘R’ is the radius of the base and ‘H’ is the height of cone.

Volume of a cone is one third of volume of a cylinder of same radius and height.

Total Surface Area of Cone
The total surface area of cone is the total area on the outer side of a cuboid. In other words, It is the number of square units that will exactly cover the outer surface of a cone. A cone is a combination of two surfaces, the curved top section with slanted height and the circular base. Hence, The total surface area of cone is sum of area of circular base and area of top curved section.
Base area of cone = Π R2
Curved surface area of cone = ΠRS
Total surface area of cone = Base area + Curved area = ΠR2 + ΠRS

C Program to find total surface area of a cone

To calculate the total surface area of a cone we need radius of circular base and height of cone. Below program first takes base radius and height of cone as input form user using scanf function and stores it in floating point variables ‘radius’ and ‘height’ respectively. Then, it calculates the total surface area of cone using the formula given above and prints the result on screen using printf function.

C Program to Calculate Volume and Total Surface Area of Cone

/*
* C Program to calculate total surface area of Cone
*/
#include <stdio.h>
#include <math.h>
#include <conio.h>
 
#define PI 3.14159
 
int main(){
    float radius, height, surfaceArea;
    printf("Enter base radius and height of a Cone\n");
    scanf("%f %f", &radius, &height);
    /* Total surface area of Cone = 
       PI X Radius X (Radius + sqrt(Height^2 + Radius^2)) */
    surfaceArea = 
        PI*radius*(radius + sqrt(height*height + radius*radius));
    printf("Total surface area of Cone : %0.4f\n",
        surfaceArea);
     
    getch();
    return 0;
}

Program Output

Enter base radius and height of a Cone
5 8
Total surface area of Cone : 226.7283

C Program to find volume of a cone

To calculate the volume of a right circular cone we need radius of circular base and height of cone. Below program first takes radius and height of cone as input form user using scanf function and stores it in floating point variables ‘radius’ and ‘height’ respectively. Then, it calculates the volume of cone using the formula given above and prints the result on screen.

C Program to find volume of a cone

/*
* C Program to calculate volume of Cone
*/
#include <stdio.h>
#include <conio.h>
 
#define PI 3.14159
 
int main(){
    float radius, height, volume;
    printf("Enter base radius and height of a Cone\n");
    scanf("%f %f", &radius, &height);
 
    /* Volume of Cone = 1/3 X PI X Radius X Radius X Height */
    volume = 1.0/3 *(PI*radius*radius*height);
 
    printf("Volume of Cone : %0.4f\n", volume);
     
    getch();
    return 0;
}

Program Output

Enter base radius and height of a Cone
5 8
Volume of Cone : 209.4393