answersLogoWhite

0

How do you find the LCM in C?

User Avatar

Anonymous

14y ago
Updated: 10/17/2024

Problem Statement for LCM:

Enter Two digits by a user and get its LCM

Answer:

#include

#include

void main()

{

int x,y,i,j;

clrscr();

printf("Enter Two Digits");

scanf("d",&x,&y);

for(i=1;i<=x;i++)

{

for(j=1;j<=y;j++)

{

if(y*i==x*j)

{

printf("LCM is %d\n",y*i);

i=i+x;

}

}

}

getch();

}

OR

there will be another easy way to solve it...

Answer:

#include

#include

void main()

{

int x,y,i,;

clrscr();

printf("Enter Two Digits = ");

scanf("d",&x,&y);

for(i=1;i<=x*y;i++) {

if(i%x==0&&i%y==0)

{

printf(LCM is %d",i);

break;

}

}

getch();

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

How can you find the Lowest common denominator of four integers?

lcm(a,b,c,d) = lcm(lcm(a,b,c),d) = lcm(lcm(a,b),lcm(c,d))


What is is the LCM of18?

You cannot find the LCM of one number. There must be two numbers to compare, because the C means common.


What is the LCM of 6 7 and C?

If C is co-prime with 6 and with 7, then LCM(6, 7, C) = 42*C If not, the answer depends on the value of C.


What is the LCM of 8 and C and C?

That would depend on the value of C.


What is the LCM of C and A?

If they have no common factors other than 1, the LCM is their product.


What does C mean in LCM?

The C stands for Common.


What is the LCM of A B and C?

That depends on the values of A, B and C.


How do you find the LCM of 3 numbers through the common division method?

Find the LCM of the first two numbers and then find the LCM of that number and the third one. That answer will be the LCM of all three.


What is the LCM of 2b2 and 6c3?

To find the least common multiple (LCM) of 2b^2 and 6c^3, we first need to factorize both terms. The prime factorization of 2b^2 is 2 * b * b, and the prime factorization of 6c^3 is 2 * 3 * c * c * c. To find the LCM, we take the highest power of each prime factor that appears in either term, which gives us 2 * 3 * b^2 * c^3 = 6b^2c^3. Therefore, the LCM of 2b^2 and 6c^3 is 6b^2c^3.


How do you find out the LCM for 36?

You need at least two numbers to find an LCM.


Find the LCM of 50?

Two or more numbers are needed to find the LCM


How do you find the LCM for 24?

You need at least two numbers to find an LCM.