Powered By Blogger

Feb 11, 2025

19. Find LCM (Least Common Multiple)

 #include <stdio.h>

int main() {

    int a, b, lcm;

    printf("Enter two numbers: ");

    scanf("%d %d", &a, &b);

    lcm = (a > b) ? a : b;

    while (1) {

        if (lcm % a == 0 && lcm % b == 0) {

            printf("LCM: %d\n", lcm);

            break;

        }

        lcm++;

    }

    return 0;

}


No comments:

Post a Comment

Featured Post

Data Analysis

    What is data analysis and its significance?   Data analysis is the process of collecting, transforming, and organizing data to dr...

Popular Posts