fork(2) download
  1. #include <iostream>
  2. #include <cstdlib>
  3.  
  4. using namespace std;
  5. int p;
  6. int l1, l2, iloczyn;
  7. int main()
  8. {
  9.  
  10.  
  11. cin>>p;
  12.  
  13. for(int i=1; i<=p; i++)
  14. {
  15.  
  16. cin >> l1;
  17. cin >> l2;
  18. if(l1==l2)
  19. {
  20. cout<<l1<<endl;
  21. }
  22. else
  23. {
  24. iloczyn = l1*l2;
  25.  
  26. do
  27. {
  28. if(l1>l2) l1=l1-l2;
  29. else l2=l2-l1;
  30. }
  31. while(l1!=l2);
  32.  
  33. cout << iloczyn/l1<<endl;
  34. }
  35. }
  36. return 0;
  37. }
  38.  
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Standard output is empty