So, while I think I am getting better (I THINK), one thing that will always stump me in programming are equations. More specifically, longer mathematical equations. Right now, I am making a "Loan Calculator". Basically, it just uses a switch in another function, returns the values to the main function and it prints it out.

Unfortunately, given the formula I need to use, I can't figure out how to incorporate it in into a loop, as well I can't really understand the equation, even though it explains it.. (I'm retarded when something involves complicated looking math.)

Here's my code thus far. I need to make a loop do two things::

--Loop to output for however many months entered and the information for each month (Posted guess at end of post) This isn't my major issue however.

--Figure out how exactly the equation works and use it in the loop (My major issue).

----EQUATION:: payment =.......... ........principal x rate....

.................... .... .......... 1 - ( (1+rate) to the power (-m) ) )

--I'v also got no idea what a "Principal" refers to.

Rate = annual interest rate

M = number of months

(I know it's not done but. I can't really do much unless I figure this calculation stuff out

So far my guess is going to be something like this for the loopCode:#include <stdio.h> #include <math.h> int menu(void); int swit(void); int main(void) { int choice; printf("1. Enter Principal\n2. Enter Annual Interest Rate\n3. Enter Duration of the loan\n4. Calculate Loan Payment\n5. Display Loan Repayment Table\n\n"); choice = menu(); printf("Month::Old Balance::Payment::Interest::Principal::New Balance"); getchar(); getchar(); return 0; } int menu(void) { int choice; int princ; int ir; int dur; int calc; printf("Make your choice from the above menu:: "); while ((choice = getchar()) != 0) { switch (choice) { case '1' : princ = getchar(); break; case '2' : ir = getchar(); break; case '3' : dur = getchar(); break; case '4' : break; case '5' : break; default : printf("You entered an invalid choice.\nPlease pick 1-5 or use 0 to exit the program\n"); break; } } return choice; }

for (i = 1; i < months; i++). However. I am somewhat confused on how to do the calculations themselves (This is the most major thing I need help with. How exactly, after each calculation, I am supposed to re-calculate for the loop.

Any help would be greatly appreciated. I am absolutely useless when it come's to math.