Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <math.h>
- #ifndef M_PI
- #define M_PI 3.14159265358979323846
- #endif
- double cylindervolume(double radius, double height)
- {
- return M_PI*radius*radius*height;
- }
- int main()
- {
- double r = 1.0, h = 1.0;
- printf("Cylinder Volume Calculation\n\n");
- while (r > 0.0 && h > 0.0)
- {
- printf("Input the radius: ");
- scanf("%lf", &r);
- printf("Input the height: ");
- scanf("%lf", &h);
- printf("\nVolume = %g\n\n",cylindervolume(r, h));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement