I'm having trouble calculating the right interest expense. The solution for interest expense is 2294.48 but cant get it.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main ()
{
double P,R,Y,M,X,A,MP,T,I;
printf("Enter the Principle:\n");
scanf("%lf",&P);
printf("Enter the Rate:\n");
scanf("%lf",&R);
printf("Enter the Years:\n");
scanf("%lf",&Y);
R = R/1200;
M = Y * 12;
X=1+R;
A=pow(X,M)-1;
MP =( R + R / A) * P;
T = MP * M;
I = R * MP;
printf("Monthly Payment is: %.2lf\n",MP);
printf("Total Payment is: %.2lf\n",T);
printf("Interest Expense is: %lf\n",I);
return 0;
}
alex1050 -4 Newbie Poster
kings_mitra -1 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.