Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <math.h>
- using namespace std;
- int main()
- {
- double balance;
- cin >> balance;
- balance *= 100;
- int counter = 0;
- while ( (int)balance != 0)
- {
- if (balance >= 200)
- {
- balance -= 200;
- }
- else if (balance >= 100)
- {
- balance -= 100;
- }
- else if (balance >= 50)
- {
- balance -= 50;
- }
- else if (balance >= 20)
- {
- balance -= 20;
- }
- else if (balance >= 10)
- {
- balance -= 10;
- }
- else if (balance >= 5)
- {
- balance -= 5;
- }
- else if (balance >= 2)
- {
- balance -= 2;
- }
- else if (balance >= 1)
- {
- balance -= 1;
- }
- counter++;
- }
- cout << counter << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement