How to write a C Program to Calculate Simple Interest with an example. Simple interest is calculated on the principal amount (original amount), without adding the interest. Unlike compound interest, simple interest does not earn interest on interest.
Before we get into the example, let me show you the formula behind the calculation:
SI = (Principal Amount*Rate of Interest*Number of years) / 100
The above-mentioned formula gives the amount of interest paid on the principal (original) amount over a specified time period. For example, if the original amount is 10,000, the interest rate is 5%, and the loan tenure is 2 years.
SI = (P * R * T) / 100
= (10000 * 5 * 2) / 100
= 1000.00
It means we must pay an extra 1000 in interest for borrowing 10,000 over a period of 2 years at an interest rate of 5%.
C Program to Calculate Simple Interest
This C program allows the user to enter the Principal Amount, Rate of Interest, and the number of years. By using those above-specified formulas, we will calculate the Simple Interest of these values within this Program.
#include<stdio.h>
int main()
{
float PAmount, ROI, Time_Period, si;
printf("\nPlease enter the Principal Amount : \n");
scanf("%f", &PAmount);
printf("Please Enter Rate Of Interest : \n");
scanf("%f", &ROI);
printf("Please Enter the Time Period in Years : \n");
scanf("%f", &Time_Period);
si = (PAmount * ROI * Time_Period) / 100;
printf("\nSimple Interest for Principal Amount %.2f is = %.2f", PAmount, si);
return 0;
}

C Program to calculate simple interest using function
In the following example, we defined a function that accepts the original amount, rate of interest, and the total number of years. Inside it, we use the mathematical formula to calculate the simple interest on the principal amount.
#include<stdio.h>
float simpleInt(float pa, float r, float y) {
return (pa * r * y) / 100.0;
}
int main()
{
float amount, ROI, years, si;
printf("Enter the Principal Amount : ");
scanf("%f", &amount);
printf("Enter Rate Of Interest : ");
scanf("%f", &ROI);
printf("Enter Time Period in Years : ");
scanf("%f", &years);
si = simpleInt(amount, ROI, years);
printf("Simple Interest for %.2f is = %.2f", amount, si);
}
Enter the Principal Amount : 150000
Enter Rate Of Interest : 7.5
Enter Time Period in Years : 5
Simple Interest for 150000.00 is = 56250.00
Also Read
Comments are closed.