Home >>c programs >C Program for EMI Calculator
In this example, we will see a C program through which we will make an EMI calculator.
This program will read the total loan amount, rate and time in years and then prints the per month EMI for that loan amount. The formula used in this program for the calculation of the EMI is : (P*R*(1+R)T)/(((1+R)T)-1).
Program:
#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;
}