-
Notifications
You must be signed in to change notification settings - Fork 0
/
volume.c
50 lines (49 loc) · 1.48 KB
/
volume.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <stdio.h>
int main(){
int ch;
float a,l,b,h,r,V;
printf("** MAIN MENU ***\n");
printf("Press 1 for select CUBE\n");
printf("Press 2 for select CUBOID\n");
printf("Press 3 for select CYLINDER\n");
printf("Press 4 for select SPHERE\n");
printf("Press 5 for select CONE\n");
printf("Enter the number for the option you want to use =");
scanf("%d",&ch);
switch (ch){
case 1:
printf("Enter value of side\n");
scanf("%f",&a);
V=a*a*a;
printf("The volume is %f",V);
break;
case 2:
printf("Enter length,breadth & hight of cuboid\n");
scanf("%f%f%f",&l,&b,&h);
V=l*b*h;
printf("The volume is %f",V);
break;
case 3:
printf("Enter radius & hight of cylender\n");
scanf("%f%f",&r,&h);
V=3.14*r*r*h;
printf("The volume is %f",V);
break;
case 4:
printf("Enter radius of sphere\n");
scanf("%f",&r);
V=(4*3.14*r*r*r)/3;
printf("The volume is %f",V);
break;
case 5:
printf("Enter radius & hight of cone\n");
scanf("%f%f",&r,&h);
V=(3.14*r*r*h)/3;
printf("The volume is %f",V);
break;
default:
printf("Error You Have Enter Wrong Number");
break;
}
return 0;
}