Monday, May 24, 2010

Please help me fix this c program---thanks?

okey...this program works properly,, all i need is to organize my results... let it display. the compound interest with the rate being __is: and so on.. please help.





#include %26lt;stdio.h%26gt;


#include %26lt;math.h%26gt;





int main(void)


{


double amount;


double principal=1000.0;


double rate= .05;


int year;


int six_percent;





printf("%4s%21s\n", "year", "Amount on deposit");





for(year=1 ;year%26lt;=10 ; year++)





for(rate=.05; rate%26lt;=0.10; rate+=.01)


{


amount=principal * pow(1.0 +rate ,year);


printf("%4d%21.2f\n"year,amount);


}


}





the program needs to display the compound interest using 5%,6%,7%,8%,9%,10% as the rate. the questions specifies that i must use a for loop..

Please help me fix this c program---thanks?
dude why dont you just not set the rate standards and have it loop right then in one of you printf statements ask the user t enter the following rates


such as 5 6 7 8 9 and 10
Reply:I don't know if it's the only problem, but you need a comma in the printf statement between the second " and the year variable.


No comments:

Post a Comment