ioana_martin98

Untitled

Jun 9th, 2021 (edited)
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int main()
  5. {
  6.     int x, y, c, k = 1, xx = 0, yy = 0, ogl = 0;
  7.     cin >> x >> y;
  8.     while (x != 0)
  9.     {
  10.         c = x % 10;
  11.         if (c % 2 == 1)
  12.         {
  13.             xx = xx + c * k;
  14.             k = k * 10;
  15.         }
  16.         x = x / 10;
  17.     }
  18.     k = 1;
  19.     while (y != 0)
  20.     {
  21.         c = y % 10;
  22.         if (c % 2 == 1)
  23.         {
  24.             yy = yy + c * k;
  25.             k = k * 10;
  26.         }
  27.         y = y / 10;
  28.     }
  29.     while (xx != 0)
  30.     {
  31.         ogl = ogl * 10 + xx % 10;
  32.         xx = xx / 10;
  33.     }
  34.     if (ogl == yy && ogl != 0)
  35.         cout << "DA";
  36.     else
  37.         cout << "NU";
  38.     return 0;
  39. }
Add Comment
Please, Sign In to add comment