Program for EMI Calculator
EMI stand for Equated Monthly Installment. This calculator is used to calculate per month EMI of loan amount if loan amount that is principal, rate of interest and time in years is given as input.
Formula:
E = (P.r.(1+r)n) / ((1+r)n – 1)
Here,
P = loan amount i.e principal amount
R = Interest rate per month
T = Loan time period in year
C
// EMI Calculator program in C #include <math.h> #include <stdio.h> // Function to calculate EMI float emi_calculator(float p, float r, float t) { float emi; r = r / (12 * 100); // one month interest t = t * 12; // one month period emi = (p * r * pow(1 + r, t)) / (pow(1 + r, t) - 1); return (emi); } // Driver Program int main() { float principal, rate, time, emi; principal = 10000; rate = 10; time = 2; emi = emi_calculator(principal, rate, time); printf("\nMonthly EMI is= %f\n", emi); return 0; } |
Java
// EMI Calculator program in java import java.io.*; public class GFG { // Function to calculate EMI static float emi_calculator(float p, float r, float t) { float emi; r = r / (12 * 100); // one month interest t = t * 12; // one month period emi = (p * r * (float)Math.pow(1 + r, t)) / (float)(Math.pow(1 + r, t) - 1); return (emi); } // Driver Program static public void main (String[] args) { float principal, rate, time, emi; principal = 10000; rate = 10; time = 2; emi = emi_calculator(principal, rate, time); System.out.println("Monthly EMI is = " + emi); } } // This code is contributed by vt_m. |
Python3
# EMI Calculator program in Python def emi_calculator(p, r, t): r = r / (12 * 100) # one month interest t = t * 12 # one month period emi = (p * r * pow(1 + r, t)) / (pow(1 + r, t) - 1) return emi # driver code principal = 10000; rate = 10; time = 2; emi = emi_calculator(principal, rate, time); print("Monthly EMI is= ", emi) # This code is contributed by "Abhishek Sharma 44" |
C#
// EMI Calculator program in C# using System; public class GFG { // Function to calculate EMI static float emi_calculator(float p, float r, float t) { float emi; r = r / (12 * 100); // one month interest t = t * 12; // one month period emi = (p * r * (float)Math.Pow(1 + r, t)) / (float)(Math.Pow(1 + r, t) - 1); return (emi); } // Driver Program static public void Main () { float principal, rate, time, emi; principal = 10000; rate = 10; time = 2; emi = emi_calculator(principal, rate, time); Console.WriteLine("Monthly EMI is = " + emi); } } // This code is contributed by vt_m. |
PHP
<?php // EMI Calculator program in PHP // Function to calculate EMI function emi_calculator($p, $r, $t) { $emi; // one month interest $r = $r / (12 * 100); // one month period $t = $t * 12; $emi = ($p * $r * pow(1 + $r, $t)) / (pow(1 + $r, $t) - 1); return ($emi); } // Driver Code $principal = 10000; $rate = 10; $time = 2; $emi = emi_calculator($principal, $rate, $time); echo "Monthly EMI is = ", $emi; // This code is contributed by anuj_67. ?> |
Output:
Monthly EMI is= 461.449677
Explanation : When we provide amount of money i.e, principal, rate of interest, time and this program will calculate amount of emi.
Recommended Posts:
- Program to check if a date is valid or not
- Program to print the diamond shape
- Program to print Happy Birthday
- Program to convert time from 12 hour to 24 hour format
- Java program to check palindrome (using library methods)
- Program to print a pattern of numbers
- Python Program to print digit pattern
- Program to find sum of elements in a given array
- C Program to Swap two Numbers
- Program to check if a given year is leap year
- Program to find largest element in an array
- Program to multiply two matrices
- Program for Tower of Hanoi
- Program to cyclically rotate an array by one
- Program to find GCD or HCF of two numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : vt_m

