1. breadth : (Datatype int) : to represent the breadth a Cylinder.
2. height : (Datatype int) : to represent the height a Cylinder.
3. volume_of_cylinder : (Datatype long) : to store the volume of Cylinder result.
Functions:printf(): is used to display something on the console/screen. Format specifier %d in printf function is used to display a int variable on screen and %ld for long. \n is used to add a newline
scanf(): is used to fetch data inputted by the user on the console/screen using keyboard. %d in scanf is indicates that inputted text is of type int and %ld for long.
Formula:
Volume of Cylinder : bredth x height
/*
* 1000+ C programs + tutorials
*
*
* 10_calculate_volume_of_cylinder.c
*
*
* Created on: Oct 20, 2014
* Author: Code2care.org
*/
#include <stdio.h>
//#include <conio.h>
void main() {
int breadth,height;
long volume_of_cylinder;
// clrscr();
printf(" Program to calculate Volume of a Cylinder : ");
printf("\n\n Enter the Breadth of Cylinder : ");
scanf("%d", &breadth);
printf("\n\n Enter the Height of Cylinder : ");
scanf("%d", &height);
volume_of_cylinder = breadth*height;
printf("\n\n Volume of Cylinder with Breadth as %d and Height as %d =
%ld",breadth,height,volume_of_cylinder);
// getch();
}
Output:
Program to calculate Volume of a Cylinder :
Enter the Breadth of Cylinder: 4
Enter the Height of Cylinder: 5
The volume of Cylinder with Breadth as 4 and Height as 5 = 20
More Posts related to C-Program,
- Calculate Volume of Sphere
- Find Sum of two numbers
- Calculate Area of Parallelogram
- Calculate Area and Circumference of Circle
- Calculate Area of Square
- Calculate Volume of Pyramid
- Division between two numbers
- Calculate Volume of Cylinder
- Calculate Volume of Cube
- Calculate Volume of Ellipsoid
- Find Difference of two numbers
- Calculate Area of Trapezoid
- Calculate Area of ellipse
- Calculate Volume of Cone
- Calculate Area of a Rectangle
More Posts:
- Indent XML Formatting In Notepad++ - NotepadPlusPlus
- [fix] Spring Boot Data JPA - No identifier specified for entity - Java
- Fix: Minecraft EXCEPTION_ACCESS_VIOLATION Fatal Error Java Runtime - Java
- Android [SDK Manager] The system cannot find the path specified - Android-Studio
- How to refresh Safari on Mac (macOS) using keyboard shortcut - MacOS
- [fix] java: incompatible types: double cannot be converted to java.lang.Integer Generics - Java
- MySQL #6 - Error on delete of './my-database/db.opt' (Errcode: 13 - Permission denied) - MySQL
- Change the default login shell on macOS Ventura 13.0 - MacOS