fork download
  1. #include<iostream>
  2. using namespace std;
  3. int NWW(int a, int b)
  4. {
  5. int c,iloczyn=a*b;
  6. while (b!=0)
  7. {
  8. c=a%b;
  9. a=b;
  10. b=c;
  11. }
  12.  
  13. return iloczyn/a;
  14. }
  15. int main()
  16. {
  17. int x,a,b,c,d,naj1,naj2;
  18. cin>>x;
  19. for(int i=0; i<x; i++){
  20. cin>>a>>b>>c>>d;
  21. naj1=NWW(a, b);
  22. naj2=NWW(naj1, c);
  23. cout<<NWW(naj2,d)<<endl;
  24. }
  25. return 0;
  26. }
Success #stdin #stdout 0s 4456KB
stdin
2
2 3 4 5
30 15 10 25
stdout
60
150