# C Program to Find Volume of Cylinder

In this post, we will learn how to find the volume of a cylinder using C Programming language.

The Volume of a cylinder is the density of the cylinder which signifies the amount of material it can carry or how much amount of any material can be immersed in it.

• Volume of Cylinder = πr2h, where r is the radius of the base and h is height of the cylinder.

We will be using this formula in our program to compute the volume of a cylinder.

So, without further ado, let’s begin this tutorial.

## C Program to Find Volume of Cylinder

```// C Program to Find Volume of Cylinder
#include <stdio.h>
int main(){
float pi, volume;

printf("Enter the height of the cylinder: ");
scanf("%d", &height);
printf("Enter the radius of the cylinder: ");

pi = 3.14;

// Calculating volume

// Displaying output
printf("Volume of Cylinder: %.2f", volume);
return 0;
}
```

Output

``````Enter the height of the cylinder: 12
Enter the radius of the cylinder: 7
Volume of Cylinder: 1846.32
``````

## How Does This Program Work ?

```    int height, radius;
float pi, volume;
```

In this program, we have declared two int data type variables and two float data type variables.

```    // Asking for input
printf("Enter the height of the cylinder: ");
scanf("%d", &height);
printf("Enter the radius of the cylinder: ");
```

Then, the user is asked to enter the radius and height of the cylinder.

```    // Calculating volume
```

Volume of the cylinder is calculated using the formula πr2h.

```    // Displaying output
printf("Volume of Cylinder: %.2f", volume);
```

Finally, the volume of the cylinder is printed as output using printf() function.

## Conclusion

I hope after going through this post, you understand how to find the volume of a cylinder using C Programming language.

If you have any doubt regarding the program, feel free to contact us in the comment section. We will be delighted to help you.