Home »
C programs »
C advance programs
EMI Calculator (C program to calculate EMI)
EMI Calculator: This program will read total loan amount (principal), rate and time in years and prints the per month EMI of that loan amount.
The formula used in this program is:
(P*R*(1+R)T)/(((1+R)T)-1)
Here,
- P is loan amount.
- R is interest rate per month - we will read in yearly and convert in monthly in program.
- T is loan time period in year - we will read in yearly and convert in monthly in program.
EMI Calculator program in C
/*EMI Calculator (C program to calculate EMI).*/
#include <stdio.h>
#include <math.h>
int main()
{
float principal, rate, time, emi;
printf("Enter principal: ");
scanf("%f", &principal);
printf("Enter rate: ");
scanf("%f", &rate);
printf("Enter time in year: ");
scanf("%f", &time);
rate = rate / (12 * 100); /*one month interest*/
time = time * 12; /*one month period*/
emi = (principal * rate * pow(1 + rate, time)) / (pow(1 + rate, time) - 1);
printf("Monthly EMI is= %f\n", emi);
return 0;
}
Output
Enter principal: 20000
Enter rate: 10
Enter time in year: 2
Monthly EMI is= 922.899536
C Advance Programs »