But it's an if statement, if i put ; at the end of the if then it will ignore everything else. I'm not getting an error on line 27 in my compiler. Im using Dev c++ if youre wondering.
-- i just tried putting ; at the end of the if statement, i get an error because the else isn't paired with an if now.
edit; also for some reason the spacing on here is really bad, even though its not the same way in my compiler. So i tried manually fixing it the best way I could since copying + pasting keeps giving it some extra and weird spaces in random places.
switched it to that, but when I run it i still get the same problem where it doesn't tell me how many months it will take, it just sits there and blinks at me taunting me, daring me to put my fist through the monitor.
The reason your program never ends and never prints out the final result is because your do-while loop never ends. You are looking for loan amount == 0.0, but that never occurs because of 1 of 2 reasons.
First, you are reducing payment every time through the while loop. That means the monthly payment is constantly being reduced. You really want to change payment in lines 32 and 33 to "principalReduction".