Advertisement
Josif_tepe

Untitled

Feb 21st, 2025
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5.  
  6. int main()
  7. {
  8.     int a, b;
  9.     cin >> a >> b;
  10.    
  11.     int pomal = a;
  12.     if(b < a) {
  13.         pomal = b;
  14.     }
  15.    
  16.     for(int i = pomal; i >= 1; i--) {
  17.         if(a % i == 0 && b % i == 0) {
  18.             cout << i << endl;
  19.             return 0;
  20.         }
  21.     }
  22.    
  23.     return 0;
  24. }
  25.  
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement