fork(1) download
  1. importPackage(java.io);
  2. importPackage(java.lang);
  3.  
  4. // your code goes here
  5. var year=2020, oldMoney = 0, interest = 0, moneyAdded = 200000, total=0, years=12, rate = 0.08;
  6. for(let i=0;i<=years;i++)
  7. {
  8. interest = oldMoney*rate;
  9. total += (interest+moneyAdded);
  10. print('1 jan '+(year+i)+' oldMoney='+oldMoney+' interest='+interest+' total='+total);
  11. oldMoney = total;
  12. }
Success #stdin #stdout 0.46s 42296KB
stdin
Standard input is empty
stdout
1 jan 2020 oldMoney=0 interest=0 total=200000
1 jan 2021 oldMoney=200000 interest=16000 total=416000
1 jan 2022 oldMoney=416000 interest=33280 total=649280
1 jan 2023 oldMoney=649280 interest=51942.4 total=901222.4
1 jan 2024 oldMoney=901222.4 interest=72097.792 total=1173320.192
1 jan 2025 oldMoney=1173320.192 interest=93865.61536000001 total=1467185.80736
1 jan 2026 oldMoney=1467185.80736 interest=117374.8645888 total=1784560.6719487999
1 jan 2027 oldMoney=1784560.6719487999 interest=142764.85375590398 total=2127325.5257047038
1 jan 2028 oldMoney=2127325.5257047038 interest=170186.04205637632 total=2497511.5677610803
1 jan 2029 oldMoney=2497511.5677610803 interest=199800.92542088643 total=2897312.4931819667
1 jan 2030 oldMoney=2897312.4931819667 interest=231784.99945455734 total=3329097.492636524
1 jan 2031 oldMoney=3329097.492636524 interest=266327.7994109219 total=3795425.292047446
1 jan 2032 oldMoney=3795425.292047446 interest=303634.0233637957 total=4299059.315411242