In today’s post, we will make a program in c to calculate Simple Interest and Compound Interest

But before that, we know what is Simple Interest and Compound Interest and how to get it out.

Page Contents

## 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
```

## Conclusion

Friends, If you have difficulty to understand any program or have any doubts or questions, then tell me in the comment below.