LCM: In arithmetic and number theory, the least common multiple, lowest common multiple, or smallest common multiple of two integers a and b, usually denoted by lcm, is the smallest positive integer that is divisible by both a and b. You can use the LCM calculator to find the LCM of Two Numbers in a matter of seconds.
Program to Find LCM of Two Numbers in C Using While Loop
#include <stdio.h>
int main()
{
int num1, num2, max;
/*Program to Find LCM of Two Numbers in C*/
printf("Enter Two Number to Find LCM of Two Numbers:\n");
scanf("%d %d", &num1, &num2);
max = (num1 > num2) ? num1 : num2;
while (1)
{
if (max % num1 == 0 && max % num2 == 0)
{
printf("LCM of %d And %d is %d", num1, num2, max);
break;
}
++max;
}
return 0;
}
0 Comments: