This is yours
Code:
#include <stdio.h>
#include <math.h>
main()
{
double i, p, n, a;
printf("Enter the amount of the loan->");
scanf("%lf\n", &p);
printf("Enter the interest rate ->");
scanf("lf\n", &i);
printf("Enter the term (in years) ->");
scanf("%lf\n",&n);
n *= 12;
a = p*(i*pow(1+i, n))/ (pow(1+i, n) -1);
printf("Your monthly payment is--->%lf", a);
}
This is mine
Code:
#include <stdio.h>
#include <math.h>
int main(void)
{
double p, x, y, a;
float r;
int n;
printf("Enter the amount of the loan ->");
scanf("%lf", &a);
printf("Enter the interest rate ------>");
scanf("%f", &r);
r=r/1200;
printf("Enter the term (in years) ---->");
scanf("%i\n",&n);
n = n / 12 ;
p = a * (r * (pow ((double) r+1 , (double) n)) ) / ( (pow ((double)
1+r , ((double) n))-1 ) );
printf("your monthly payment is :%f\n", p);
return 0;
}