hey there...
need ur guys help to highlight my mistakes..
i'm suppose to get the output below...
LOAN ADVISOR
Car purchase price/loan <RM>: 15000
Down payment <RM>:0
Payment period <in year>:7
Monthly salary:1500
Monthly payment <RM>:228.57
Status:ELIGIBLE
but, i cant get it..
please help me to improve my program..
i dont know where is my mistake..
Code:
#include <stdio.h>
void loan_calculate (float L, float DP, int Y, float S, float *monthlyPtr, char status [], float I);
int main ()
{
float L, DP, S, I;
int Y;
char status [20];
printf("LOAN ADVISOR\n");
printf("Car purchase price/loan <RM>: \n");
scanf("%f", &L);
if (L < 50000)
I = 4.0%;
else if (L < 100000 && L >= 50000)
I = 3.5%;
else if (L >= 100000)
I = 3.0%;
printf("Down payment <RM>: \n");
scanf("%f", &DP);
printf("Payment period <in year>: \n");
scanf("%d", &Y);
printf("Monthly salary: \n");
scanf("%f", S);
loan_calculate (&monthlyPtr, &status);
printf("Monthly payment <RM>: %f\n", monthlyPtr);
printf("Status: %s\n", status);
return 0;
}
void loan_calculate (float L, float DP, int Y, float S, float *monthlyPtr, char status [], float I){
*monthlyPtr = ((L-DP) + ((L-DP) * (I/100) * Y)) / (12 * Y);
if (*monthlyPtr <= ((25/100)*S))
status == ELIGIBLE
else
status == NOT ELIGIBLE
return;
}