fork download
  1. #include <stdio.h>
  2. #define PERIOD 10
  3. #define PRINCIPAL 5000.00
  4. main(void)
  5. {
  6. int year;
  7. float amount, value, inrate;
  8. amount = PRINCIPAL;
  9. inrate= 0.11;
  10. year= 0;
  11.  
  12. while(year <=PERIOD)
  13. {
  14. printf("%2d %8.2f\n", year, amount);
  15.  
  16. value=amount+inrate*amount;
  17. year= year+1;
  18. amount=value;
  19. }
  20.  
  21. }
  22.  
Success #stdin #stdout 0s 2112KB
stdin
Standard input is empty
stdout
 0         5000.00
 1         5550.00
 2         6160.50
 3         6838.15
 4         7590.35
 5         8425.29
 6         9352.07
 7        10380.80
 8        11522.69
 9        12790.19
10        14197.11