1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
void CalcMP (float PR, float IM, float Q, float MP, float IY, float P, int NM);
void printinfo (float PR, float IY, float IM, int NY, int NM, float MP);
void printTable (int Month, float balance, float MP, float Interest, float total, int NM, float IM);
int main ()
{
float total = 0;
int Month = 1;
float PR;
float IY;
int NY;
int NM;
float IM;
float P;
float Q;
float MP;
float Interest;
float balance;
float newbalance;
printf("Amount of the loan (principal)?\t\t");
scanf("%f", &PR);
printf("Intrest rate per year (percent)\t\t");
scanf("%f", &IY);
printf("Number of years?\t\t\t");
scanf("%d", &NY);
CalcMP (PR, IM, Q, MP, IY, P, NM);
NM = NY * 12;
Interest = PR * IM;
balance = PR;
printinfo (PR, IY, IM, NY, NM, MP);
printTable(Month, balance, MP, Interest, total, NM, IM);
system ("pause");
return 0;
}
void CalcMP (float PR, float IM, float Q, float MP, float IY, float P, int NM)
{
IM = (IY / 12) / 100;
P = pow((1 + IM), NM);
Q = (P/ (P - 1));
MP = (PR * IM * Q);
return;
}
|