fork download
  1. #include <iostream>
  2. using namespace std; int main(int argc, const char * argv[]) {
  3.  
  4. float fee = 0.50;
  5. int widthdrawl = 0.00;
  6. float balance = 0.00;
  7.  
  8. //cout << "Enter widthdrawl amount and bank balance ex[30 120]" << endl;
  9. cout.precision(6);
  10. cin >> widthdrawl;
  11. cin >> balance;
  12.  
  13. while(balance > 0){
  14. if((widthdrawl + fee) > balance) {
  15. cout << balance << endl;
  16. // cout << "Not enough money in account" << endl;
  17. break;
  18. }
  19.  
  20. else if(widthdrawl % 5 != 0) {
  21. cout << balance << endl;
  22. //cout << "Did not enter a multiple of 5" << endl;
  23. break;
  24. }
  25.  
  26. else if((widthdrawl % 5 == 0)) {
  27. balance = balance - widthdrawl - fee;
  28. cout << balance << endl;
  29. break;
  30. }
  31.  
  32. }
  33.  
  34. return 0;
  35. }
  36.  
  37.  
Success #stdin #stdout 0s 3432KB
stdin
42 120
stdout
120