Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main(){
- int n;
- int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0;
- cin >> n;
- if (n >= 50) {
- a = n / 50;
- n = n % 50;
- }
- if (n >= 20) {
- b = n / 20;
- n = n % 20;
- }
- if (n >= 10) {
- c = n / 10;
- n = n % 10;
- }
- if (n >= 5) {
- d = n / 5;
- n = n % 5;
- }
- if (n >= 2) {
- e = n / 2;
- n = n % 2;
- }
- if (n >= 1) {
- f = n / 1;
- }
- cout << "50 = " << a << endl;
- cout << "20 = " << b << endl;
- cout << "10 = " << c << endl;
- cout << "5 = " << d << endl;
- cout << "2 = " << e << endl;
- cout << "1 = " << f << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement