Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int tab[8] = {100, 50, 20, 10, 5, 2, 1};
- int amount;
- cin >> amount;
- int i = 0;
- int note, multiplier;
- while (amount > 0) {
- note = tab[i];
- if(note <= amount) {
- multiplier = amount / note;
- for(int j = 0; j< multiplier; j++)
- cout << note << " ";
- amount = amount - (multiplier * note);
- }
- i++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement