#include
#include
#define PI 3.142
int main () {
int radius;
int height;
int volume;
int program;
printf ("Enter 2 to start and 8 to quit\t");
scanf ("%d", &program);
while (program !=9)
{
printf ("Press \n 1 for radius \n 3 for height \n 5 to volume \n 9 to quit:\t");
scanf ("%d", &program);
if (program==1) {
printf ("Enter the value in radius\t");
scanf ("%d", &radius); }
if (program==3) {
printf ("Enter the value for height:\t");
scanf ("%d", &height); }
if (program==5) {
volume = PI * radius * radius * height;
printf ("\n VOLUME OF CYLINDER WITH RADIUS %dUNITS: & HEIGHT %dUNITS: IS %d CUBIC UNITS\n", radius, height, volume);
printf ("\n Do you wish to calculate the Volume of another Cylinder?\n"); }
}
system ("pause");
return 0;
}
No comments:
Post a Comment