+ 1

Anyone can teach me how to create a home mortgage calculator via c programming?😅

3rd Nov 2018, 1:18 PM
Ng Jin Yuan
Ng Jin Yuan - avatar
10 Antworten
+ 3
I think you should first try yourself, then come back when you are stuck (in this thread for example), and ask us to help you ! I would be glad to do so but just asking for a whole program is not my thing, I think it is not what helps people learn, sorry
4th Nov 2018, 9:28 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 3
As rate does not change, you can and should also calculate pow only once and store the result
17th Nov 2018, 2:47 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
Ok, I will try it! Thank you.
5th Nov 2018, 1:30 AM
Ng Jin Yuan
Ng Jin Yuan - avatar
+ 1
Can you share the code here please ? It will help me understand
15th Nov 2018, 5:46 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
You can replace the switch by this line : balance = principal*pow((1+rate/100/ratio[interval - 1]), ratio[interval - 1]); You'll have to initialize ratio first like this : int ratio[] = {12, 4, 2, 1};
17th Nov 2018, 2:41 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
You can also do the switch only once and change the value of interval accordingly, or do : interval = ratio[interval - 1]
17th Nov 2018, 2:46 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
I need to repeat the calculations for principal amount and balance for every year. I set "balance" to 0. It is used to count for the principal amount of first year. Then, I need to count for the value of balance(principal amount*(1+rate)^n) for first year also. But the output is 0... How can I assign the 0 value for counting the principal amount bit not the balance?
15th Nov 2018, 5:29 AM
Ng Jin Yuan
Ng Jin Yuan - avatar
16th Nov 2018, 6:20 AM
Ng Jin Yuan
Ng Jin Yuan - avatar
0
I solved by separating the first year calculation and the subsequent year but the code looks not so nice already...
16th Nov 2018, 6:45 AM
Ng Jin Yuan
Ng Jin Yuan - avatar
0
How can I improve it?
17th Nov 2018, 12:52 PM
Ng Jin Yuan
Ng Jin Yuan - avatar