Method-1 #include<stdio.h> int main() { int a,b,i,lcm,max; printf("Enter first number\n"); scanf("%d",&a); printf("Enter second number\n"); scanf("%d",&b); max=a>b?a:b; lcm=max; for(i=1;i<=max;i++) { if(max%a==0&&max%b==0) { lcm=max; break; } max=lcm+max; } printf("LCM of %d and %d is=%d",a,b,lcm); } Method-2 #include<stdio.h> int main() { int a,b,i; printf("Enter first number\n"); scanf("%d",&a); printf("Enter second number\n"); scanf("%d",&b); for(i=1;;i=i+1) { if(i%a==0&&i%b==0) { printf("LCM of %d and %d is=%d",a,b,i); break; } } } OUTPUT Enter first number 30 Enter second number 9 LCM of 30 and 9 is=90 Visit