Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 82b308d

Browse files
Add files via upload
1 parent 474e98a commit 82b308d

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

‎Compound Profit Calculation.c‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#include<stdio.h>
2+
#include<stdlib.h>
3+
#include<math.h>
4+
int main()
5+
{
6+
printf("Date :%s\n", __DATE__ );
7+
printf("Time :%s\n", __TIME__ );
8+
9+
int ch;
10+
float p,r,n,a,i;
11+
float c,cp,si;
12+
13+
while(1)
14+
{
15+
printf("\n~~~~Profit Calculation~~~~\n\n");
16+
printf(" 1. Compound Profit Calculation. \n");
17+
printf(" 2. Simple Profit Calculation.\n");
18+
printf(" 3. Exit\n\n");
19+
20+
printf("Enter your choice : ");
21+
scanf("%d",&ch);
22+
23+
if(ch>0&&ch<4)
24+
{
25+
switch(ch)
26+
{
27+
case 1:
28+
printf("\nEnter Principal Amount: ");
29+
scanf("%f",&p);
30+
printf("Enter Rate of Interest: ");
31+
scanf("%f",&r);
32+
printf("Enter Time-line: ");
33+
scanf("%f",&n);
34+
35+
c= p*(pow((1+r/100),n));
36+
cp=c-p;
37+
printf("\nCompound Profit: %.2f\n",cp);
38+
printf("Compound Principal Amount: %.2f\n",c);
39+
40+
break;
41+
42+
case 2:
43+
printf("\nEnter Principal Amount: ");
44+
scanf("%f",&p);
45+
printf("Enter Rate of Interest: ");
46+
scanf("%f",&r);
47+
printf("Enter Time-line: ");
48+
scanf("%f",&n);
49+
50+
si=(p*r*n)/100;
51+
printf("\nSimple Profit: %.2f\n",si);
52+
a=si+p;
53+
printf("Total Principal Amount: %.2f\n\n",a);
54+
break;
55+
56+
case 3:
57+
printf("\n\tHave a nice Day!\n\n");
58+
exit(0);
59+
}
60+
}
61+
else
62+
printf("Invalid Choice!\n\n");
63+
}
64+
return 0;
65+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /