328. Loan EMI
MediumFormula
Print the monthly EMI for principal P, annual interest rate R% and n months, using EMI = P·r·(1+r)ⁿ / ((1+r)ⁿ − 1) with r = R/1200. Print with 2 decimal places. If R is 0, EMI = P/n.
Input format
A single line: P R n
Output format
The EMI with 2 decimals, e.g. 8791.59
Example 1
Input
100000 10 12
Output
8791.59
Example 2
Input
500000 8.5 60
Output
10258.27
Constraints
1 ≤ P ≤ 10⁸ 0 ≤ R ≤ 30 1 ≤ n ≤ 360
Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.
Loading the MyLoginn IDE…