ok, i'm new to c++, please bear with me........
i have a program... it asks the user to enter the price, then it asks to enter the interest rate from, and then interest rate to, and then the loan period (> 2 years)
The formula used is:
result = price * pow(1+annual rate of interest/100/365, loan period *365)
it should be desplayed like this:
8% 9% 10%
Year 2 result result result
year 3 result result result
.
.
year 4 result result result
the preceding was if: interest rate from was 8, and interest rate to was 10, and if the user entered 4 for the loan period.......so it basically needs to calculate the result for each percentage and for each year ofcourse......how do i do this using for loop....thanks alot for your help..........this is what i've done so far:
int year, price, intratefrom, intrateto, x, y, loanp;
double CPL;
printf("\n");
printf("Car Loan Financing\n\n\n");
printf("Please enter price of car:");
scanf("%d", &price);
printf("\nPlease enter interest rate (integer %) from :");
scanf("%d", &intratefrom);
printf("Please enter interest rate (integer %) to :");
scanf("%d", &intrateto);
printf("Please enter loan period, from 2 years to (integer) :");
scanf("%d", &loanp);
printf("\n\n");
SO THIS IS WHERE I"M STUCK, I"VE TRIED USING FOR BUT IT JUST DESNT DISPLAY RIGHT(CPL assigned is the result) ACTALLY ALL THIS CALCULATION AND DISPLAY should be DONE IN THE FUNCTION which i named financing(), i dont know how to do that in the new function without using global variables :( :
for( x = intratefrom; x <= intrateto; x++){
for(year = 2; year <= loanp; year++){
}
}
financing(); //call the function financing
}