SHARE
TWEET

Untitled

a guest Apr 19th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <math.h>
  4.  
  5. #ifndef M_PI
  6. #define M_PI 3.14159265358979323846
  7. #endif
  8.  
  9. double cylindervolume(double radius, double height)
  10. {
  11.     return M_PI*radius*radius*height;
  12. }
  13.  
  14. int main()
  15. {
  16.     double r = 1.0, h = 1.0;
  17.     printf("Cylinder Volume Calculation\n\n");
  18.     while (r > 0.0 && h > 0.0)
  19.     {
  20.         printf("Input the radius: ");
  21.         scanf("%lf", &r);
  22.         printf("Input the height: ");
  23.         scanf("%lf", &h);
  24.         printf("\nVolume = %g\n\n",cylindervolume(r, h));
  25.     }
  26.     return 0;
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top