fork(1) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. int a,b,r,x,y,t,z;
  7. scanf ("%d",&t);
  8. while(t--)
  9. {
  10. scanf ("%d %d",&a,&b);
  11. x = a;
  12. y = b;
  13. z = a*b;
  14. while(b!=0)
  15. {
  16. r = a%b;
  17. a = b;
  18. b = r;
  19. }
  20. printf ("LCM( %d, %d) = %d\n",x,y,z/a);
  21.  
  22. }
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 9432KB
stdin
2
1 5
6 4
stdout
LCM(    1,    5) =     5
LCM(    6,    4) =     12