C Programs | IT Developer
IT Developer

C Programs



Share with a Friend

EMI Calculator Program in C

Introduction

EMI (Equated Monthly Installment) is the fixed amount paid by a borrower to a lender every month to repay a loan.

The formula to calculate EMI is:

EMI = ( P×R×(1+R)N ) / ((1+R)N−1)

Where:

  • P = Loan amount (Principal)
  • R = Monthly interest rate = (Annual Rate of Interest ÷ 12 × 100)
  • N = Loan tenure in months

 

C Program: EMI Calculator

C

#include <stdio.h>

#include <math.h>  // for pow() function

 

int main() {

    float principal, rate, emi;

    int time, n;

    float monthlyRate;

 

    // Input values

    printf("Enter the loan amount (Principal): ");

    scanf("%f", &principal);

 

    printf("Enter annual rate of interest (in %%): ");

    scanf("%f", &rate);

 

    printf("Enter loan tenure (in years): ");

    scanf("%d", &time);

 

    // Convert values

    n = time * 12;                 // Total number of months

    monthlyRate = rate / (12 * 100); // Monthly interest rate

 

    // EMI formula

    emi = (principal * monthlyRate * pow(1 + monthlyRate, n)) /

          (pow(1 + monthlyRate, n) - 1);

 

    // Display result

    printf("\nLoan Amount: %.2f", principal);

    printf("\nAnnual Interest Rate: %.2f%%", rate);

    printf("\nTenure: %d years (%d months)", time, n);

    printf("\nMonthly EMI: %.2f\n", emi);

 

    return 0;

}

Output

 
OUTPUT :
Enter the loan amount (Principal): 500000
Enter annual rate of interest (in %): 10
Enter loan tenure (in years): 5

Loan Amount: 500000.00
Annual Interest Rate: 10.00%
Tenure: 5 years (60 months)
Monthly EMI: 10624.59


Explanation

  1. User inputs principal, annual interest rate, and tenure in years.
  2. Program converts tenure into months.
  3. Annual interest rate is converted into a monthly rate.
  4. EMI is calculated using the formula with pow() from <math.h>.
  5. Result is displayed clearly.