As of right now, i'v spent the better half of the past 24 hours trying to make my program output the right answers to a given formula, using printf. I'll post the given equation, what I got out of it, and then what I need. I'm hoping someone can point me in the right direction on a couple things, which I will ask below the equation::
Code:myarray = principal, myarray = rate, myarray = months //what was given// payment = principal x rate 1 - ( (1+rate) to the power (-m) ) ) //What I got from it// payment = (myarray * myarray) / 1 - ( (myarray ^(-myarray)) ); Total of what I need:: printf("Month::Old Balance::Payment::Interest::Principal::New Balance\n");
Basically, I need the outputs from the final line, and i'm running into two main issues::
1:: I'm not overly intelligent with math.
2:: I need my for loop to count down each month, and each month, modify all the data until it reaches the final month, and the loans balance is set to 0.
Now i'm not looking for direct answers, but I am really bad in math and I could definitely use some guidance. And below is the loop i'm decided to test::
I figure this loop is probably wrong, however it's been my best guess so far, and atleast it's counting down in the loop when I run a printf statement.Code:for(i = 0;i < myarray; myarray--);
Thanks for any help you can give on this. I figured it'd be best to ask for some help since I haven't really left ground-zero after numerous attempts.