Skip to content

Instantly share code, notes, and snippets.

@mehagel
Created May 6, 2013 21:21
Show Gist options
  • Save mehagel/5528302 to your computer and use it in GitHub Desktop.
Save mehagel/5528302 to your computer and use it in GitHub Desktop.
def mean(array)
results =0
mean = 0
array.length.times do |i|
results = results + array[i]
puts mean = results.to_i/ array.length
end
results
mean
end
mean([5,6,7,8])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment