-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathA menu based program.cpp
More file actions
54 lines (53 loc) · 1.28 KB
/
A menu based program.cpp
File metadata and controls
54 lines (53 loc) · 1.28 KB
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
51
52
53
54
/* A menu based program to perform the operation according to the
choice of the user.*/
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int main()
{
char c;
float r,pi,Area_circle,Circumference;
int a,l,b,h,Volume,TSA,Area;
do{
printf(" 1. Volume of Cuboid \n 2. Total Surface Area of Cuboid \n 3. Area of Circle\n 4. Circumference of Circle\n 5. Exit\n");
printf("Enter your choice=");
scanf("%d",&a);
switch(a)
{
case 1:
printf("Enter length, breadth and height of cuboid=");
scanf("%d%d%d",&l,&b,&h);
Volume= l*b*h;
printf("The volume of cuboid=%d\n",Volume);
break;
case 2:
printf("Enter length, breadth and height of cuboid=");
scanf("%d%d%d",&l,&b,&h);
TSA=2*(l*b+b*h+l*h);
printf("The total surface area of cuboid=%d\n",TSA);
break;
case 3:
printf("Enter radius of circle=");
scanf("%f",&r);
pi=3.14;
Area_circle= pi*r*r;
printf("The area of circle=%.2f \n",Area_circle);
break;
case 4:
printf("Enter radius of circle=");
scanf("%f",&r);
pi=3.14;
Circumference= 2*pi*r;
printf("The circumference of Circle=%.2f\n",Circumference);
break;
case 5:
exit(1);
default:
printf("Wrong Input \n");
}
printf("Do you want to continue? [Y/N]:");
scanf(" %c",&c);
}while(c=='Y'|| c=='y');
return 0;
getch();
}