Thursday, 16 December 2021

To calculate EMI for Amount, Period and Interest.

 # Monthly Interest Rate (r) = R/(12*100)


# Varaible name details:
# p = Principal or Loan Amount
# r = Interest Rate Per Month
# n = Number of monthly installments

# Reading inputs from user
p = float(input("Enter principal amount: "))
R = float(input("Enter annual interest rate: "))
n = int(input("Enter number of months: " ))

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

# Calculating Equated Monthly Installment (EMI)
emi = p * r * ((1+r)**n)/((1+r)**n - 1)

print("Monthly EMI = ", emi)

Output

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

No comments:

Post a Comment