Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- float money;
- cin >> money;
- int amount = money * 100;
- int count = 0;
- int nominals[] { 200, 100, 50, 20, 10, 5, 2, 1 };
- for (int i = 0; amount; ++i)
- {
- int num = amount / nominals[i];
- if (num)
- {
- count += num;
- amount -= num * nominals[i];
- }
- }
- cout << count << '\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement