Here's a method to find the greatest common divisor of a list of integers in C# using Euclid's algorithm:
main.cs476 chars22 lines
The GetGCD
method takes a list of integers as input and iterates through the list, calling the GetGCD
method on the current element and the result so far. The GetGCD(int a, int b)
method uses Euclid's algorithm to recursively find the greatest common divisor of two numbers.
gistlibby LogSnag