Computer Science, asked by ishaqueidrisgmailcom, 8 days ago

write a menu drive program to calculate and print volume of sphere, volume of cylinder,volume of cone according to user choice volume of sphere-4/3 r², volume of cylinder-r²h, volume of cone 1/3 r²h​

Answers

Answered by Iwilltrytoanswer
0

Answer:

this is for c programs if you need another language make another question and include the language name

volume of sphere:

#include <stdio.h>

int main()

{

int radius=48;

float pie=3.14285714286;

double volume=(4.0/3.0)*pie*(radius*radius*radius);

printf("Volume of the sphere=%f",volume);

}

volume of cylinder:

/*

* C Program to Find the Volume and Surface Area of cylinder

*/

#include <stdio.h>

#include <math.h>

int main()

{

float radius, height;

float surface_area, volume;

printf("Enter value for radius and height of a cylinder : \n");

scanf("%f%f", &radius, &height);

surface_area = 2 * (22 / 7) * radius * (radius + height);

volume = (22 / 7) * radius * radius * height;

printf("Surface area of cylinder is: %.3f", surface_area);

printf("\n Volume of cylinder is : %.3f", volume);

return 0;

}

Volume of Cone:

/*

* C Program to Find the volume and surface area of cone

*/

#include <stdio.h>

#include <math.h>

int main()

{

float radius, height;

float surface_area, volume;

printf("Enter value of radius and height of a cone :\n ");

scanf("%f%f", &radius, &height);

surface_area = (22 / 7) * radius * (radius + sqrt(radius * radius + height * height));

volume = (1.0/3) * (22 / 7) * radius * radius * height;

printf("Surface area of cone is: %.3f", surface_area);

printf("\n Volume of cone is : %.3f", volume);

return 0;

}

Similar questions