Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int tab[8] = {100, 50, 20, 10, 5, 2, 1};
  7. int amount;
  8. cin >> amount;
  9.  
  10. int i = 0;
  11. int note, multiplier;
  12. while (amount > 0) {
  13. note = tab[i];
  14. if(note <= amount) {
  15. multiplier = amount / note;
  16. for(int j = 0; j< multiplier; j++)
  17. cout << note << " ";
  18. amount = amount - (multiplier * note);
  19. }
  20. i++;
  21. }
  22.  
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement