i tried switching it to %lf and its still not going through and the whole line with b = ("(%lf) /12."), r; is because in the later equations i need the monthly interest rate which is the annual interest rate (%lf) divided by 12, if you could tell me another way to write it so that it would work thatd be great. heres what i have now and what it tells me, thanks so much for helping me out here:
Code:
#include<stdio.h>
#include<math.h>
main()
{
double num1, p;
printf("enter price:\n");
scanf("%d",&p);
printf("\t\t\tMonthly Payments\nAnn. Int. Rates\t15-year loan\t20-year loan\t30-
year loan\n--------------------------------------------------------------\n");
int k;
double r, m1, m2, m3, tot1, tot2, tot3, n, m, o, b;
n=180;
m=240;
o=360;
for(k=0; k<=12; k++)
{
r=(.0450+(.0025*k)), k;
b = ("(%lf) /12."), r;
m1 = (p)*(b)*(pow(1 + b, (double)n))/(pow(1+b, (double)n)-1);
m2 = (p)*(b)*(pow(1 + b, (double)m))/(pow(1+b, (double)m)-1);
m3 = (p)*(b)*(pow(1 + b, (double)o))/(pow(1+b, (double)o)-1);
tot1 = (n * m1);
tot2 = (m * m2);
tot3 = (o * m3);
printf("\t%1.4f\n",r);
}
}
and what it says:
Code:
HW3.c: In function `main':
HW3.c:17: incompatible types in assignment