# C Program to Calculate Simple Interest

Howdy readers, today you will learn how to write a program to calculate simple interest using C Programming language.

Simple interest is a method to calculate the amount of interest charged on an amount at a given rate and for a given period of time.

Simple interest is calculated using the following formula:

Simple Interest = (P x R x T) / 100, where P is the principal amount, R is the rate of interest and T is the time period.

We will be using this formula in our program to compute simple interest.

So, without any delay, letâ€™s begin this tutorial.

## C Program to Calculate Simple Interest

C Program

```// C Program to Calculate Simple Interest
#include <stdio.h>
int main(){
float principal, rate, time, SI;

printf("Enter the principal amount: ");
scanf("%f", &principal);
printf("Enter the rate of interest: ");
scanf("%f", &rate);
printf("Enter the time period: ");
scanf("%f", &time);

// Calculating simple interest
SI = (principal * rate * time) / 100;

// Displaying output
printf("Simple Interest: %.2f", SI);
return 0;
}
```

Output

``````Enter the principal amount: 20000
Enter the rate of interest: 3
Enter the time period: 6
Simple Interest: 3600.00
``````

Explanation

```    float principal, rate, time, SI;
```

In this program, we have declared four float data type variables named principal, rate, time and SI.

```    // Asking for input
printf("Enter the principal amount: ");
scanf("%f", &principal);
printf("Enter the rate of interest: ");
scanf("%f", &rate);
printf("Enter the time period: ");
scanf("%f", &time);
```

Then, the user is asked to enter the principal amount, rate of interest and time period.

```    // Calculating simple interest
SI = (principal * rate * time) / 100;
```

We calculate the simple interest using the formula SI = (PxRxT)/100. The simple interest gets stored in the SI named variable.

```    // Displaying output
printf("Simple Interest: %.2f", SI);
```

Finally, the simple interest is displayed on the screen using printf() function. Here, we have used %.2f format specifier because we want to display the result only till 2 decimal places.

## Conclusion

I hope after reading this post, you understand how to write a program to calculate simple interest using C Programming language.

If you face any difficulty while understanding this program, then let us know in the comment section. We will be delighted to solve your query.