Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main ()
  5. {
  6. short int n, x, y;
  7. cin >> n;
  8.  
  9. if (n > 20) n = 20; // !!
  10.  
  11. for (short int licznik = 0; licznik < n; ++licznik)
  12. {
  13. cin >> x >> y;
  14.  
  15. short int iloczyn = x*y;
  16.  
  17. do
  18. {
  19. if(x>y) x=x-y;
  20. else y=y-x;
  21. }
  22. while(x!=y);
  23.  
  24. cout << iloczyn/x << "\n";
  25. }
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement