### Loan related C++ help needed.

I was given a sample program to calculate Total Repayment. Which is as follow:

 ``123456789101112131415161718192021222324252627`` ``````#include #include int loan( double n , double m , double l ){ int repayment = 0; while( l > 0 ){ if( l - m > 0 ){ repayment = repayment + m; }else{// repayment = repayment + l; } l = (int) ( ( l - m ) * pow( 1 + n / 100.0 , 1 / 12.0 ) ); 　} 　return( repayment ); } void main(){ int l = 4500000;//initials borrowing int m = 20000;//monthly repayment double n = 5.0;//anual interest rate int repayment = loan( n , m , l ); printf("Total = %d Yen \n", repayment ); }``````

but I was asked to change the program that able to find how much is the Monthly Repayment IF the Total Repayment is given which is 5,800,000 Yen.

I need to state the
1) idea of how to find the solution
2) the solution of the program
3) the result.

Thanks in advance for your help. I'm sorry for my bad English. I translated some of the language in the program because the original one was in Japanese.
Last edited on
http://easycalculation.com/mortgage/loan-payment-amount.php
You can use that equation and compute the number of months N. Your monthly payment is 5.8e6/N
Topic archived. No new replies allowed.