fork(2) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int l1,l2,c;
  5.  
  6.  
  7. int NWD(int a, int b)
  8. {
  9. int pom;
  10.  
  11. while(b!=0)
  12. {
  13. pom = b;
  14. b = a%b;
  15. a = pom;
  16. }
  17. return a;
  18. }
  19.  
  20. int main()
  21. {
  22.  
  23. cin>>l1;
  24. cin>>l2;
  25.  
  26. if (l1%l2==0)
  27. cout<< l1;
  28. else if (l2%l1==0)
  29. cout<< l2;
  30. else
  31.  
  32. c=NWD(l1,l2);
  33. cout<<l1*l2/c;
  34.  
  35. return 0;
  36. }
  37.  
Runtime error #stdin #stdout 0s 4552KB
stdin
15 30
stdout
Standard output is empty