/ Undifined / 2 - WAP that calculates the Simple Interest and Compound Interest. The Principal. ,Amount. Rate of Interest and Time are entered through the keyboard.

2 - WAP that calculates the Simple Interest and Compound Interest. The Principal. ,Amount. Rate of Interest and Time are entered through the keyboard.

C-Program to calculate simple and compound interest

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include<stdio.h>
#include<math.h>
int main()
{
     float p,q,r,SI,CI;
     int n;
   printf("Enter the value of Principal p = ");
     scanf("%f",&p);
     printf("Enter the value of Rate r = ");
     scanf("%f",&r);
     printf("Enter the value of Period in year n = ");
     scanf("%d",&n);
   SI = ((p*r*n)/100);
printf("Simple Interest SI=%f \n",SI);
q = 1+(r/100);
CI=p*pow(q,n)-p;
   printf("Compound Interest CI=%f \n",CI);
return 0;   
}

Sample Input
Enter the value of Principal p = 1000
Enter the value of Rate r = 12
Enter the value of Period in year n = 2
Sample Output
Simple Interest SI=240.000000
Compound Interest CI=254.400009



WAP that calculates the Simple Interest and Compound Interest. The Principal , Amount, Rate of Interest and Time are entered through the keyboard.

Input

#include<stdio.h>
void main()
{
	float p,r,t,i;
	clrscr();
	printf("Enter principal amount : ");
	scanf("%f",&p);
	printf("\nEnter Rate of Interest : ");
	scanf("%f",&r);
	printf("\nEnter time period : ");
	scanf("%f",&t);
	i=(p*r*t)/100;
	printf("\nInterest calculated is %f",i);
	getch();
}

Output


Enter principal amount : 5000
 
Enter Rate of Interest : 10.5
 
Enter time period : 7
 
Interest calculated is 3675.000000

about author

Blogger Sens it website about blogger templates and blogger widgets you can find us on social media
Previous Post :Go to tne previous Post
Next Post:Go to tne Next Post

No comments:

Post a Comment