Do you know how to use the debugger? This would be a really really good time to start learning if not.
But for starters, this line is probably doing the most damage:
while (newLoanBal >0);
That semico at the end of the line is deadly: It’s an infinite loop. The while loop ends at that semico, so newLoanBal is always > 0.
I believe you are off by 1 here:
for (i = 0; i<= 2; i++)
That loop will execute the body 3 times. i=0 <=2, i=1 <=2 i=2 <= 2.
You only want it to execute 2 times, right?
Do you know how to use the debugger? This would be a really really good time to start learning if not.
But for starters, this line is probably doing the most damage:
while (newLoanBal >0);
That semico at the end of the line is deadly: It’s an infinite loop. The while loop ends at that semico, so newLoanBal is always > 0.
I believe you are off by 1 here:
for (i = 0; i<= 2; i++)
That loop will execute the body 3 times. i=0 <=2, i=1 <=2 i=2 <= 2.
You only want it to execute 2 times, right?
What is the j loop for?