Commit b6398460 authored by Owen Ilagan's avatar Owen Ilagan

arrgh...

parent 15b58637
numbers = [1,2,3,4,5,6,7,8,9,10]
def get_average(array)
count = array.size
sum = 0
array.each do |num|
sum = sum + num
end
return sum/count
end
def get_reverse(array)
result = []
array.reverse.each do |num|
result.push(num)
end
return result
end
puts 'Numbers are: ' + numbers.join(',')
puts 'Average value is ' + get_average(numbers).to_s
puts 'Reverse is ' + get_reverse(numbers).join(',')
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment