# C Program to Calculate Volume and Total Surface Area of Cylinder

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

A cylinder is a three dimensional solid that has two circular bases connected by a curved surface. A cylinder can be formed by two circles of same radius(R) and the curved surface formed by all the points at a distance of R from axis(axis is a line segment joining the center of both bases). Cylinder objects are very common in everyday life, like a cylindrical can.

• Radius : The radius of a cylinder is the radius of it's circular base. It is half of the diameter of the cylinder.
• Height : Height of a cylinder is the perpendicular distance between the parallel bases.
• Axis : It is the line segment joining the centers of both circular bases.

Here, we are discussing about right circular cylinder, means the bases of the cylinder are circular and the axis is perpendicular to both bases.

Total Surface Area of Cylinder
Surface area of cylinder is the number of square units that will exactly cover the outer surface of a cone. There are three surfaces in a cylinder, one curved and two circular bases. Total surface area of cylinder is the sum of the area of both circular bases and area of curved surface. Total surface area of a right circular cylinder is measured in square units like m2, cm2 etc.

Base area of cylinder = ΠR2
Curved surface area of cone = 2ΠRH
Total surface area of cone = 2XBase area + Curved area
= 2ΠR2 + 2ΠRH
= 2ΠR(R + H)
Volume of Cylinder
The volume of a right circular cylinder is defined as the amount of three dimensional space occupied by the cylinder or the storage capacity of a cylinder. Finding volume of a cylinder help us to solve many real life problems like, how much water can be filled in a cylindrical aluminium can. To calculate the volume of a cylinder, we need radius of base height of cylinder. Volume of a right circular cylinder is measured in cubic units like m3, cm3 etc.
Volume of right circular cylinder = Base area x Height
As base of cylinder is circular, Base Area = ΠR2

Volume of right circular cylinder = ΠR2H
Where 'R' is the radius of the base and 'H' is the height of cylinder.

## C Program to find total surface area of a cylinder

To calculate total surface area of a cylinder, we need radius of base and height of cylinder. Below program takes base radius and height of cylinder as input from user using scanf function. Then, it calculates the total surface area of cylinder using formula given above. Finally, it prints the surface area of cylinder on screen using printf function.
```/*
* C Program to calculate total surface area
* of Cylinder
*/
#include <stdio.h>
#include <conio.h>

#define PI 3.14159

int main(){
printf("Enter base radius and height of a Cylinder\n");
/* Total surface area of Cylinder =
printf("Total surface area of Cylinder : %0.4f\n",
surfaceArea);

getch();
return 0;
}
```

Program Output
```Enter base radius and height of a Cylinder
3 8
Total surface area of Cylinder : 207.3449
```

## C Program to find volume of a cylinder

To calculate volume of a cylinder, we need radius of base and height of right circular cylinder. Below program takes base radius and height of right circular cylinder as input from user using scanf. Then, it calculates the volume of cylinder using formula given above. Finally, it prints the volume of right circular cylinder on screen using printf.
```/*
* C Program to calculate volume of Cylinder
*/
#include <stdio.h>
#include <conio.h>

#define PI 3.14159

int main(){
printf("Enter base radius and height of a Cylinder\n");

/* Volume of Cylinder = PI X Radius X Radius X Height */

printf("Volume of Cylinder : %0.4f\n", volume);

getch();
return 0;
}
```

Program Output
```Enter base radius and height of a Cylinder
3 8
Volume of Cylinder : 226.1945
```

Properties of Cylinder
• The bases are always congruent and parallel to each other.
• There are 2 plane surfaces, 1 curved surface and 2 edges in a cylinder.
• Volume of a cylinder is 3 times the volume of a cone of same base radius and height.

Related Topics
 C program to calculate volume and total surface area of cuboid C program to calculate volume and total surface area of cone C program to calculate volume and total surface area of sphere C program to calculate area of a square C program to calculate area of a right angled triangle C program to calculate area of an equilateral triangle C program to remove vowels from a string C Program to find frequency of characters in a string List of all C Programs