fork(1) download
  1. #include <iostream>
  2. using namespace std ;
  3.  
  4. int main (void)
  5. {
  6.  
  7. float X,Y, Z; // amount to be withdrawn ,available balance and amount after transaction
  8.  
  9. cin>> X>> Y;
  10.  
  11. if ((((int)X % 5) !=0 ) || (X > 2000)) // wrong entry or insufficient funds
  12.  
  13. cout<<Y<<endl;
  14.  
  15. else
  16. if(X> Y)
  17.  
  18. cout<<Y<<endl;
  19.  
  20. else
  21. {
  22. Z=(Y-(X+0.5));
  23. cout<< Z;//display balance after transaction
  24. }
  25. return 0;
  26.  
  27. }
Success #stdin #stdout 0s 3432KB
stdin
10 10.00
stdout
-0.5