Advertisement
Guest User

Untitled

a guest
Nov 17th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5.     int n;
  6.     int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0;
  7.     cin >> n;
  8.     if (n >= 50) {
  9.         a = n / 50;
  10.         n = n % 50;
  11.     }
  12.     if (n >= 20) {
  13.         b = n / 20;
  14.         n = n % 20;
  15.     }
  16.     if (n >= 10) {
  17.         c = n / 10;
  18.         n = n % 10;
  19.     }
  20.     if (n >= 5) {
  21.         d = n / 5;
  22.         n = n % 5;
  23.     }
  24.     if (n >= 2) {
  25.         e = n / 2;
  26.         n = n % 2;
  27.     }
  28.     if (n >= 1) {
  29.         f = n / 1;
  30.     }
  31.    
  32.     cout << "50 = " << a << endl;
  33.     cout << "20 = " << b << endl;
  34.     cout << "10 = " << c << endl;
  35.     cout << "5 = " << d << endl;
  36.     cout << "2 = " << e << endl;
  37.     cout << "1 = " << f << endl;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement