+ 1
Anyone can teach me how to create a home mortgage calculator via c programming?đ
10 Answers
+ 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
+ 3
As rate does not change, you can and should also calculate pow only once and store the result
+ 1
Ok, I will try it! Thank you.
+ 1
Can you share the code here please ? It will help me understand
+ 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};
+ 1
You can also do the switch only once and change the value of interval accordingly, or do :
interval = ratio[interval - 1]
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?
0
I solved by separating the first year calculation and the subsequent year but the code looks not so nice already...
0
How can I improve it?