fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int bulan = 3;
  6. double tabungan, total = 0, bonus = 0;
  7.  
  8. double tabunganBulan1 = 400000;
  9. double tabunganBulan2 = 300000;
  10. double tabunganBulan3 = 500000;
  11.  
  12. total = tabunganBulan1 + tabunganBulan2 + tabunganBulan3;
  13.  
  14. if (total >= 1000000) {
  15. bonus = total * 0.05;
  16.  
  17. }
  18.  
  19. cout << "Jumlah bulan = " << bulan << endl;
  20. cout << "Tabungan bulan ke-1 = Rp" << tabunganBulan1 << endl;
  21. cout << "Tabungan bulan ke-2 = Rp" << tabunganBulan2 << endl;
  22. cout << "Tabungan bulan ke-3 = Rp" << tabunganBulan3 << endl;
  23.  
  24. cout << "Total tabungan = Rp" << total << endl;
  25. cout << "Bonus = Rp" << bonus << endl;
  26. cout << "Total akhir = Rp" << total + bonus << endl;
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
Jumlah bulan = 3
Tabungan bulan ke-1 = Rp400000
Tabungan bulan ke-2 = Rp300000
Tabungan bulan ke-3 = Rp500000
Total tabungan = Rp1.2e+06
Bonus = Rp60000
Total akhir = Rp1.26e+06