fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. int a,b,c,d,e,f,g,h,i,j,k;
  7.  
  8. cin >> a;
  9.  
  10. b = a / 1000;
  11. c = a % 1000;
  12.  
  13. d = c / 500;
  14. e = c % 500;
  15.  
  16. f = e / 100;
  17. g = e % 100;
  18.  
  19. h = g / 50;
  20. i = g % 50;
  21.  
  22. j = i / 25;
  23. k = i % 25;
  24.  
  25. cout << "1000: " << b << endl;
  26. cout << "500: " << d << endl;
  27. cout << "100: " << f << endl;
  28. cout << "50: " << h << endl;
  29. cout << "25: " << j << endl;
  30. // your code goes here
  31. return 0;
  32. }
Success #stdin #stdout 0s 5320KB
stdin
400
stdout
1000: 0
500:  0
100: 4
50: 0
25: 0