Skip to content

Instantly share code, notes, and snippets.

@justuseapen
Created November 17, 2013 00:44
Show Gist options
  • Save justuseapen/7507477 to your computer and use it in GitHub Desktop.
Save justuseapen/7507477 to your computer and use it in GitHub Desktop.
SCORES = [75,
100,
85,
65,
84,
87,
95]
def average
sum = 0
SCORES.each do |score|
sum += score
end
average = sum / SCORES.length
puts average
end
def high
scores = SCORES.sort.reverse
puts scores[0]
end
def low
scores = SCORES.sort
puts scores [0]
end
average
high
low
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment