fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. float startValue = 100;
  5. float interestRate = 0.015;
  6. float firstYearValue;
  7. float secondYearValue;
  8. float thirdYearValue;
  9. firstYearValue = startValue + (startValue * interestRate);
  10. secondYearValue = firstYearValue + (firstYearValue * interestRate);
  11. thirdYearValue = secondYearValue + (secondYearValue * interestRate);
  12. /* Your code */
  13. printf("After first year: %f\n", firstYearValue);
  14. printf("After second year: %f\n", secondYearValue);
  15. printf("After third year: %f\n", thirdYearValue);
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 5276KB
stdin
Standard input is empty
stdout
After first year: 101.500000
After second year: 103.022499
After third year: 104.567833