Introduction to simple interest and compound interest
Simple Interest and Compound Interest is a way to calculate the interest on the loan taken by you. Simple interest is calculated on the principal amount, this formula is used to calculate the simple interest.
S.I = (P * R * T) / 100 where P = Principal, R = Rate and T = Time
Compound interest is calculated on the principal amount plus that interest. This formula is used to calculate compound interest.
CI = P(1 + r / n)nt where P = Principal, R = Rate, n = number of compounding periods per unit and T = Time.
C Program to Calculate Simple interest
Algorithm -:
Program start.
Declaration of variable with their data type, like :- int P, R, T; float I;
Input the value in variable
Arithmetic operator used to perform SI=(p*r*t)/100;
printf( ) called to print value of variable
Program end.
Flowchart -:
Program For Simple Interest
#include<stdio.h>
#include<conio.h>
void main()
{
int p,r,t;
float i;
printf("Enter the Principal, Rate and Time\n");
scanf("%d %d %d",&p,&r,&t);
/*Formula for calculating simple interest*/
i=p*r*t/100;
printf("simple interest is : %f",i);
getch();
}
Output -:
Enter the Principal, Rate and Time
1000
7
8
simple interest is : 560.00000
C Program to Calculate Coumpound interest
Algorithm
Program start.
Declaration of variable with their data type, like :- int p, r, t,CI; float I;
Input the value in variable
CI = p*pow((1+r/100),t);
printf( ) called to print value of CI
Program end.
Program for Compound Interest
#include<stdio.h>
int main()
{
float p,r,t,CI;
printf("Enter Principle, rate and time\n");
scanf("%f%f%f",&p,&r,&t);
/*Formula for calculating
Compound Interest
*/
CI = p*pow((1+r/100),t);
printf("Compound interest is : %f\n", CI);
return 0;
}
Output -:
Enter Principle, rate and time
1000
7
8
Compound interest is : 1718.186890
C Program For simple interest and Compound interest
Algorithm
Program start.
Declaration of variable with their data type, like :- int p, r, t,i, CI; float
Input the value in variable
i=p*r*t/100;
CI = p*pow((1+r/100),t);
printf( ) called to print value of i and CI
Program end.
#include<stdio.h>
int main()
{
float p,r,t,CI;
printf("Enter Principle, rate and time\n");
scanf("%f%f%f",&p,&r,&t);
/*Formula for calculating Compound Interest */
i=p*r*t/100;
/*Formula for calculating Compound Interest*/
CI = p*pow((1+r/100),t);
printf("simple interest is : %f",i);
printf("Compound interest is : %f\n", CI);
return 0;
}
Output
Enter Principle, rate and time
1000
7
8
simple interest is : 560.000000
Compound interest is : 1718.186890
Introduction to simple interest and compound interest
Simple Interest and Compound Interest is a way to calculate the interest on the loan taken by you. Simple interest is calculated on the principal amount, this formula is used to calculate the simple interest.
S.I = (P * R * T) / 100 where P = Principal, R = Rate and T = Time
Compound interest is calculated on the principal amount plus that interest. This formula is used to calculate compound interest.
CI = P(1 + r / n)nt where P = Principal, R = Rate, n = number of compounding periods per unit and T = Time.
C Program to Calculate Simple interest
Algorithm -:
Flowchart -:
Program For Simple Interest
Output -:
C Program to Calculate Coumpound interest
Algorithm
Program for Compound Interest
Output -:
C Program For simple interest and Compound interest
Algorithm
Output
need an explanation for this answer? contact us directly to get an explanation for this answer