Advertisement
allia

бинарный

Sep 12th, 2020
1,102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.   int a=0, b=0, n=1;
  9.   cin >> a >> b;
  10.   while (a!=0 && b!=0)
  11.   {
  12.     if (a%2 ==0 && b%2==0)
  13.     {
  14.       while (a%2!=0 || b%2!=0 || (a%2!=0 && b%2!=0))
  15.       {
  16.         a/=2;
  17.         b/=2;
  18.         n*=2;
  19.       }
  20.     }
  21.    
  22.   }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement