fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int a, b, max;
  5. printf("Enter two numbers:\n ");
  6. scanf("%d %d", &a, &b);
  7.  
  8. max = (a > b) ? a : b;
  9.  
  10. while (1) {
  11. if (max % a == 0 && max % b == 0) {
  12. printf("LCM = %d\n", max);
  13. break;
  14. }
  15. max++;
  16. }
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0.01s 5284KB
stdin
4 5
stdout
Enter two numbers:
 LCM = 20