/* * Program to Find LCM (Lowest Common Multiple) of two Numbers */ #include /* Entry point to program */ int main() { int n1, n2, min; printf("Enter two positive integers:\n"); scanf("%d %d", &n1, &n2); /* Maximum number between n1 and n2 is stored in min */ min = (n1 > n2) ? n1 : n2; while (1) /* Dont worry about "constant relational expression" (warning), There is a relational expression that will always be true ... */ { if (min % n1 == 0 && min % n2 == 0) { printf("The LCM of %d and %d is %d.", n1, n2, min); break; /* ... but we can exit loop here */ } ++min; } return 0; }