C program to calculate simple interest; Through this tutorial, you will learn how to calculate simple interest in c program with the help of function, and normal formula.

## Programs to Calculate Simple Interest in C

Let’s use the following algorithm to write a program to calculate simple interest (i = (p*r*n)/100 ) in c:

- Algorithm to Calculate Simple Interest
- C Program to Calculate Simple Interest using Formula
- C Program to Calculate Simple Interest using Function

### Algorithm to Calculate Simple Interest

Use the following algorithm to write a program to calculate simple interest; as follows:

- Get input principle amount and store in some variable.
- Get input time and store in some variable..
- Get input rate and store in some variable..
- To calculate simple interest using formula
`SI = (principle * time * rate) / 100`

. - Finally, print the result of simple interest.

### C Program to Calculate Simple Interest using Formula

```
/**
* C program to calculate simple interest
*/
#include <stdio.h>
int main()
{
float principle, time, rate, SI;
/* Input principle, rate and time */
printf("Enter principle (amount): ");
scanf("%f", &principle);
printf("Enter time: ");
scanf("%f", &time);
printf("Enter rate: ");
scanf("%f", &rate);
/* Calculate simple interest */
SI = (principle * time * rate) / 100;
/* Print the resultant value of SI */
printf("Simple Interest = %f", SI);
return 0;
}
```

**The output of the above c program; as follows:**

Enter principle (amount): 10000 Enter time: 1.5 Enter rate: 5 Simple Interest = 750.000000

### C Program to Calculate Simple Interest using Function

```
/**
* C program to calculate simple interest
*/
#include <stdio.h>
// function for finding simple interest
float SimpleInt(float p, float r, float t)
{
float si;
si = (p * r * t)/100; // formula
return si; // returning yhe value of si
}
int main()
{
float principle, time, rate, SI;
/* Input principle, rate and time */
printf("Enter principle (amount): ");
scanf("%f", &principle);
printf("Enter time: ");
scanf("%f", &time);
printf("Enter rate: ");
scanf("%f", &rate);
/* Call function with paramters to Calculate simple interest */
SI = SimpleInt(principle, rate, time);
/* Print the resultant value of SI */
printf("Simple Interest = %f", SI);
return 0;
}
```

**The output of the above c program; as follows:**

Enter principle (amount): 20000 Enter time: 2 Enter rate: 5 Simple Interest = 2000.000000