-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFormulas Menu.cpp
115 lines (106 loc) · 3.46 KB
/
Formulas Menu.cpp
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#include<stdio.h>
#include<math.h>
#include<process.h>
#define pf printf
#define sf scanf
int main()
{
pf("\n********************************Formula Menu***********************************");
float a,b,c,s;
int n;
while(1)
{
pf("\n*****************************************************************************");
pf("\n1.Simple Interest");
pf("\n2.Compound Interest");
pf("\n3.Area of Triangle");
pf("\n4 Area of Circle");
pf("\n5.Area of Squre");
pf("\n6.Area of Rectangle");
pf("\n7.Volume of Cube\n8.Volume of Cuboid\n9.Exit\n\nEnter your choice: ");
sf("%d",&n);
switch(n)
{
//***************************SIMPLE INTEREST********************************************
case 1:
pf("\nEnter Value of Principle=");
sf("%f",&a);
pf("\nEnter Value of Rate=");
sf("%f",&b);
pf("\nEnter value of Time=");
sf("%f",&c);
s=(a*b*c)/100;
pf("\nSimple Interset=%.2f\n",s);
continue;
//***************************COMPOUND INTEREST******************************************
case 2:
pf("\nEnter Value of Principle=");
sf("%f",&a);
pf("\nEnter Value of Rate=");
sf("%f",&b);
pf("\nEnter value of Time=");
sf("%f",&c);
s=pow(a*(1+b)/100,c);
pf("\nCompound Interset=%.2f\n",s);
continue;
//**************************AREA OF TRIANGLE*******************************************
case 3:
pf("\nEnter Value of Base of triangle=");
sf("%f",&a);
pf("\nEnter Value of height of triangle=");
sf("%f",&b);
s=(1/2.0)*a*b;
pf("\nArea of Triangle=%.2f\n",s);
continue;
//**************************AREA OF CIRCLE*******************************************
case 4:
pf("\nEnter Value of radius of Circle=");
sf("%f",&a);
s=3.14*pow(a,2);
pf("\nArea of Circle=%.2f\n",s);
continue;
//**************************AREA OF SQUARE*******************************************
case 5:
pf("\nEnter Value of a Side of Square=");
sf("%f",&a);
s=pow(a,2);
pf("\nArea of Square=%.2f\n",s);
continue;
//**************************AREA OF RECTANGLE*******************************************
case 6:
pf("\nEnter Value of Length of Rectangle=");
sf("%f",&a);
pf("\nEnter Value of Width of Rectangle=");
sf("%f",&b);
s=a*b;
pf("\nArea of Rectangle=%.2f\n",s);
continue;
//**************************VOLUME OF CUBE*******************************************
case 7:
pf("\nEnter Value of a Side of Cube=");
sf("%f",&a);
s=pow(a,3);
pf("\nVolume of Cube=%.2f\n",s);
continue;
//**************************VOLUME OF RECTANGLE*******************************************
case 8:
pf("\nEnter Value of a Length of Cuboid=");
sf("%f",&a);
pf("\nEnter Value of a Width of Cuboid=");
sf("%f",&b);
pf("\nEnter Value of a Height of Cuboid=");
sf("%f",&c);
s=a*b*c;
pf("\nVolume of Cuboid=%.2f\n",s);
continue;
//**************************EXIE FROM MENU*******************************************
case 9:
exit(0);
//**************************INVALID INPUT*******************************************
default:
pf("\nInvalid Input\n");
continue;
}
return 0;
}
}