//calculate on interest rate
for(rate=0.05; rate <=0.1; rate++)
{
amount = principal*pow(1+rate, year);
// output data
printf("%0.2f $%8.2f\n", rate, amount);
}
I'm supposed to show the interest rate from 5 percent to 10 percent for an outer loop. For some reason, it won't show from 0.05 to 0.10 as a result. When I change the numbers from 0.05 to 5 and 0.10 to 10. It works for me.
That gave me a hint that I cannot use decimal places for a loop. How can I fix that? I have to display as decimal places.