Home >>c programs >C Program for EMI Calculator

C Program for EMI Calculator

C Program to design an 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;
}

Output:
Enter principal: 50000
Enter rate: 2
Enter time in year: 2
Monthly EMI is= 2127.015137