Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- const int money[9] = {5000, 1000, 500, 100, 50, 10, 5, 2, 1};
- int arr[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
- int k;
- cin >> k;
- for (int i = 0; i < 9; ++i) {
- arr[i] = k / money[i];
- k %= money[i];
- }
- for (int i = 0; i < 9; ++i) {
- cout << arr[i] << " ";
- }
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement