Advertisement
zenados

Height Cylinder

Sep 14th, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2. #define PI 3.141592653589793
  3.  
  4. int main() {
  5.     double volume, radius;
  6.     printf("Input volume: ");
  7.     scanf("%lf", &volume); //get the volume of the cylinder
  8.  
  9.     printf("Input radius: ");
  10.     scanf("%lf", &radius); //get the radius of the cylinder
  11.  
  12.     double height = volume/(radius*radius*PI); //calculate the height of the cylinder
  13.     printf("Height of Cylinder: %lf\n", height); //output it to height  console
  14.  
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement