Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int x, y;
  6.     int max = 0;
  7.     int max2 = 0;
  8.     cout << "x= ";
  9.     cin >> x;
  10.     cout << "y= ";
  11.     cin >> y;
  12.     int min = x % 10;
  13.     int min2 = y % 10;
  14.     while (x != 0 && y!=0)
  15.     {
  16.  
  17.         if (max < x % 10)
  18.         {
  19.             max = x % 10;
  20.         }
  21.         if (min > x % 10)
  22.         {
  23.             min = x % 10;
  24.         }
  25.         x = x / 10;
  26.         if (max2 < y % 10)
  27.         {
  28.             max2 = y % 10;
  29.         }
  30.         if (min2 > y % 10)
  31.         {
  32.             min2 = y % 10;
  33.         }
  34.         y = y / 10;
  35.     }
  36.     cout << max * 10 + max2 << endl;
  37.     cout << min * 10 + min2;
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement