C Tutorial
This c program is used to compute the volume of a cylinder based on the user inputs radius and height.
Volume of a cylinder = π × raidus x radius × height
// Finds the volume of a cylinder #include<stdio.h> void main() { int radius, height; float volume=0, pi=3.14; printf("\nFinds volume of a cylinder\n-------------------"); printf("\nEnter radius: "); scanf("%d", &radius); printf("\nEnter height: "); scanf("%d", &height); volume = pi*(radius*radius*height); printf("Volume of a cylinder is: %.2f", volume); }
Output:
$ cc volume-of-cylinder.c $ ./a.out Finds volume of a cylinder ------------------- Enter radius: 8 Enter height: 9 Volume of a cylinder is: 1808.64
C Tutorial
Privacy Policy | Copyright2020 - All Rights Reserved. | Contact us
| Report website issues in Github
| Facebook page
| Google+ page