Like GCD(a,b,c,d,f)
Here a=10,b=12,c=14,d=16 and so on.
I want a c code of GCD of more than 3 no.?
You could, in theory, factor all of the numbers and multiply
their common elements to find the GCD of all numbers.
It wouldn't be very efficient, though.
Instead, you should start with a good implementation of
the Euclidean algorithm for two numbers, GCD(a,b).
Then you can synthesize the function you asked for
using the identity:
gcd(a, b, c) = gcd(gcd(a, b), c)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment