This is a homework assignment, and I do have permission to get help as long as the code is not written for me. The inner loop is working correctly and procucing 6 lines of correct calculations to correspond with my t values; however, I cannot get it to run back through the outer loop for the other 4 values of "i". I need it to run back through the outer loop for i= .06, .07, .08, .09, and .10. Can anyone tell me where I am messing up?
I am using MS Visual C++ but am writing in C.
Thank you,
Jon
Code:
----------------------------------------------------------------------------------
#include <stdio.h>
#include <math.h>
int main(void)
{
int p=100000, t=5, e;
double m, a, z, y, i=.06;
printf(" Mortgage Payment Plan\n\n");
printf("Princ. Int. Rate Dur. Monthly Total\n");
printf(" (years) Pay. pay.\n\n");
while (i<=0.10){
while (t<=30) {
e=t*12;
z=(1/(1+i/12));
y=pow(z, e);
m=(i/12)*p/(1-y);
a=m*t*12;
printf(" %d %.2lf %2.d %8.2lf %.2lf\n", p, i, t, m, a);
t=t+5;
}
i=i+.01;
}
return 0;
}
------------------------------------------------------------------------------------