Advertisement
Josif_tepe

Untitled

Feb 21st, 2025
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 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.     int nzd = 1;
  17.     for(int i = pomal; i >= 1; i--) {
  18.         if(a % i == 0 && b % i == 0) {
  19.             nzd = i;
  20.             break;
  21.         }
  22.     }
  23.    
  24.     cout << abs(a * b) / nzd << endl;
  25.    
  26.     return 0;
  27. }
  28.  
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement