# C Program To Calculate Simple Interest

In this post, we will learn how to calculate simple interest using C Programming language.

Simple Interest is a method to calculate the amount of interest charged on a sum at a given rate and for a given period of time. In simple interest, the principal amount is always the same.

Simple Interest is calculated using the formula S.I. = P x R x T, where P = Principal Amount, R = Rate of Interest in % per annum and T = Time usually calculated as the number of years.

We will be using the same formula in our program to calculate the simple interest.

So, without further ado, letâ€™s begin this tutorial.

## C Program To Calculate Simple Interest

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

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

SI = (principal * time * rate) / 100;
printf("Simple Interest for Principal Amount %.2f is %.2f", principal, SI);
return 0;
}
```

Output

``````Enter the principal amount: 18000
Enter the time period: 2
Enter the rate of interest: 6
Simple Interest for Principal Amount 18000.00 is 2160.00
``````

## How Does This Program Work ?

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

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

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

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

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

We calculate the Simple Interest using the formula (P x R X T) / 100. The value of simple interest gets stored in SI named variable.

``````    printf("Simple Interest for Principal Amount %.2f is %.2f", principal, SI);
``````

Then, simple interest for the principal amount is printed using printf() function. We have used %.2f format specifier because we want to display the result only till 2 decimal places.

## Conclusion

I hope after going through this post, you understand how to calculate simple interest using C Programming language.

If you have any doubts regarding the program, feel free to contact us in the comment section. We will be delighted to help you.