In this article, we are going to learn how to calculate Simple Interest using a C language program. Simple Interest can be calculated by using a simple formula.
The formula for simple interest is:
Simple Interest = (Principal * Time * Rate of Interest)/100
- Principal – This is the amount borrowed on interest.
- Time – This is time for which this money is borrowed.
- Rate of Interest – This is the rate in % at which interest will be charged.
- “Hello, World!” Program in C Language
- C Program to take input from users and print
- C Program to Add or Subtract two Integers
- C Program to Multiply and Divide Two Numbers
- C Program to Find Size of int, float,double, char, structure
- C Program to Find ASCII Value of Character
- C Program to Check Even or Odd Number
- C Program to Swap two numbers
C Program to Calculate Simple Interest
Now let us see this formula in action using the C program below.
#include<stdio.h>
int main()
{
float PrincipalAmt, time, rate, SimpleInterest;
printf("Please enter the Principal Amount: ");
scanf("%f",&PrincipalAmt);
printf("Please enter the Rate of Interest: ");
scanf("%f",&rate);
printf("Please enter the Time: ");
scanf("%f",&time);
SimpleInterest = ( PrincipalAmt * time * rate ) / 100;
printf("The Simple Interest due is : %.2f\n",SimpleInterest);
return 0;
}
Output
Please enter the Principal Amount: 1200
Please enter the Rate of Interest: 5
Please enter the Time: 6
The Simple Interest due is : 360.00