answersLogoWhite

0


Best Answer

The following code for example is a solution (you could do it with less variables, but this is more readable):
int GCD(int a, int b){
int n, k, c;
n = (a>b)?a:b;
k = (a>b)?b:a;
while (k){
c = n%k;
n=k;
k=c;
}
return n;
}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Least common multiple in C programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the least common multiple of C and 360?

Their product.


What is the least common multiple of 8 C A?

LCM(8, C, A) = 8*C*A.


Which of the follwing pairs have a least common multiplyer a is 4 and 6 b is 3 and 8 c is 2 and 12 d is 3 and 6?

a). The least common multiple of 4 and 6 is 12 . b). The least common multiple of 3 and 8 is 24 . c). The least common multiple of 2 and 12 is 12 . d). The least common multiple of 3 and 6 is 6 . Gosh, I guess they all have.


What is the least common multiple of 5 C and C?

Since variables can be any number, that could be any multiple of 5.


What is the least common multiple of 20c and 12c?

It is: 60c


What is the least common multiple of A and C?

Variables can be any number. The LCM possibilities are infinite.


Is 18 a least common multiple A 18 B 36 C 9 D 4?

C is this your homework??


What is the least common multiple of 4?

You need two numbers to find a least common multiple. The LCM (least common multiple) is the smallest positive whole number exactly divisible by two or more given whole numbers. The C in LCM stands for common and in general we only talk about common multiples of two or more numbers.You need at least two numbers to find an LCM.


What is the least common multiple of 40 and 80 a 120 b 80 c 40?

It is b: 80


What is the least common multiple of C B and A?

To answer that, you'll need to have a numerical value for the letters.


What is c and why you use?

C is a programming language, and it's mostly used for Systems Programming. Most kernels these days have at least some C code in them.


A common program language?

Yes, C is a common programming language.