fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int a;
  8. cout << "Enter the amount: ";
  9. cin >> a;
  10.  
  11. cout << "No. of 1000 peso bills: " << a/1000;
  12. a %= 1000;
  13. cout << "\nNo. of 500 peso bills: " << a%1000/500;
  14. a %= 500;
  15. cout << "\nNo. of 100 peso bills: " << a%500/100;
  16. a %= 100;
  17. cout << "\nNo. of 50 peso bills: " << a%100/50;
  18. a %= 50;
  19. cout << "\nNo. of 20 peso bills: " << a%50/20;
  20. a %= 20;
  21. cout << "\nNo. of 10 peso bills: " << a%20/10;
  22. a %= 10;
  23. cout << "\n\nThe rest of the amount: " << a;
  24.  
  25. }
Success #stdin #stdout 0s 3344KB
stdin
34757
stdout
Enter the amount: No. of 1000 peso bills:  34
No. of 500  peso bills:  1
No. of 100  peso bills:  2
No. of 50   peso bills:  1
No. of 20   peso bills:  0
No. of 10   peso bills:  0

The rest of the amount: 7