C Program to Calculate Monthly EMI (Equated Monthly Installment)

This C program calculates an equated monthly installment (EMI).

EMI is calculated using following formula:

EMI = p * r * (1+r)n/((1+r)n-1)

p = Principal or Loan Amount
r = Interest Rate Per Month
n = Number of monthly installments

If the interest rate per annum is R% then interest rate per month is calculated using:
Monthly Interest Rate (r) = R/(12*100)

C Source Code: EMI


int main()
 float p, R, r, emi;
 int n;

 /* Reading inputs */
 printf("Enter principal amount: ");
 scanf("%f", &p);
 printf("Enter annual interest rate: ");
 scanf("%f", &R);
 printf("Enter number of months: ");
 scanf("%d", &n);

 /* Calculating interest rate per month */
 r = R/(12*100);

 /* Calculating equated monthly intsallment (EMI) */
 emi = p * r * pow(1+r,n)/(pow(1+r,n)-1);

 printf("Monthly EMI: %f", emi);

 return 0;


Enter principal amount: 1000000
Enter annual interest rate: 7
Enter number of months: 120
Monthly EMI =  11610.847656