Hey guys, new to the board and C programming in general. I have this assignment that's giving me problems, don't know what's wrong.
Monthly Pay=[ rate + rate /([1+rate]^months -1)] X principle
Where rate of %6 means 6/1200
Months means number of years x 12
"Possible data to test:
Principle 12200
Rate 7%
Term in years 5
Monthly payment is: 241.57"
My code:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void main ()
{
double princ, rate, term, monthly;
printf("Please enter the the principle on your payment: ");
scanf("%lf", &princ);
printf("Please enter the rate on your payment: ");
scanf("%lf", &rate);
printf("Please enter the term of your payment in years: ");
scanf("%lf", &term);
rate = (rate/1200);
term = (term*12);
monthly = ((rate + (rate/(pow((1 + rate),(term-1))))) * princ);
printf("Your monthly payment is: %f", monthly);
return 0;
}
For my monthly payment I always end up getting half of what is expected. Any ideas?