• 10-09-2006
newcstudent
#include <stdio.h>
#include <math.h>

int main(void)

{

double r, a, p, x, powr, n;

printf("How long is the loan in years?\n");

scanf("%d", &n);

n = n / 12;

printf("How much did you borrow?\n");

scanf("%lf", &a);

printf("What is it's interest?\n");

scanf("%lf", &r);

x = r + 1;

powr = pow((double) x , (double) n);

p = (r * powr ) / ( powr - 1 );

printf("your monthly payment is : %f", p);

return 0;

}

see any errors?
• 10-09-2006
SKeane
Code:

```#include <stdio.h> #include <math.h> int main(void) {     double r, a, p, x, powr, n;     printf("How long is the loan in years?\n");     scanf("%d", &n);    /* n is a double not an integer !! So don't use %d */     n = n / 12;     printf("How much did you borrow?\n");     scanf("%lf", &a);     printf("What is its interest?\n");     scanf("%lf", &r);     x = r + 1;     powr = pow((double) x , (double) n);     p = (r * powr ) / ( powr - 1 );     printf("your monthly payment is : %f", p);     return 0; }```
• 10-09-2006
Ken Fitlike
This is essentially the same problem raised here: