-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCompound Profit Calculation.c
More file actions
65 lines (56 loc) · 1.82 KB
/
Compound Profit Calculation.c
File metadata and controls
65 lines (56 loc) · 1.82 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
55
56
57
58
59
60
61
62
63
64
65
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
printf("Date :%s\n", __DATE__ );
printf("Time :%s\n", __TIME__ );
int ch;
float p,r,n,a,i;
float c,cp,si;
while(1)
{
printf("\n~~~~Profit Calculation~~~~\n\n");
printf(" 1. Compound Profit Calculation. \n");
printf(" 2. Simple Profit Calculation.\n");
printf(" 3. Exit\n\n");
printf("Enter your choice : ");
scanf("%d",&ch);
if(ch>0&&ch<4)
{
switch(ch)
{
case 1:
printf("\nEnter Principal Amount: ");
scanf("%f",&p);
printf("Enter Rate of Interest: ");
scanf("%f",&r);
printf("Enter Time-line: ");
scanf("%f",&n);
c= p*(pow((1+r/100),n));
cp=c-p;
printf("\nCompound Profit: %.2f\n",cp);
printf("Compound Principal Amount: %.2f\n",c);
break;
case 2:
printf("\nEnter Principal Amount: ");
scanf("%f",&p);
printf("Enter Rate of Interest: ");
scanf("%f",&r);
printf("Enter Time-line: ");
scanf("%f",&n);
si=(p*r*n)/100;
printf("\nSimple Profit: %.2f\n",si);
a=si+p;
printf("Total Principal Amount: %.2f\n\n",a);
break;
case 3:
printf("\n\tHave a nice Day!\n\n");
exit(0);
}
}
else
printf("Invalid Choice!\n\n");
}
return 0;
}