03-25-2010, 08:23 PM
Code:
def highest_number(a)
length = a.length
great = a[0].to_i
for i in 0..length do
if a[i].to_i > great
great = a[i]
end
end
puts great
end
def gcf(a,b)
array = []
for i in 1..a do
if a % i == 0 and b % i == 0
array << i
end
end
num = []
num << highest_number(array)
end
#Example
gcf(12,20)