C program to calculate Simple Interest

In this post, I am going to show you how to write a simple C program to calculate the Simple Interest.

The formula to calculate the Simple Interest is,

Simple Interest = (Principal × Time × Rate ) / 100

Same formula we have to apply here, so let’s write the C program now,

#include <stdio.h>
int main()
{
	//declare variables
	float Principal, Time, Rate, SimpleInterest;
    
	//get the values from user
	printf("Enter the Principal Amount:");
	scanf("%f", &Principal);
	printf("Enter the Rate of interest:");
	scanf("%f",&Rate);
	printf("Enter the Time:");
	scanf("%f", &Time);
    
	//find the Simple Interest
	SimpleInterest = (PrincipleAmount * Rate * Time)/ 100;
    
	//print the valuee
	printf("Simple Interest is :%.2f",SimpleInterest);
	return 0;

}

Let’s see a sample output of the above C program:

SI = (5000 × 2 × 8.2) / 100 = 820.00

Where,
P = 5000
T = 2 (yrs)
r = 8.2%

Enter the Principal Amount:5000
Enter the Rate of Interest:8.2
Enter the Time:2
Simple Interest is: 820.00

I hope this program is helpful for beginner C programming learners and school/college students.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top