skelbley
and many others are using
Hackety Hack
to learn how to code.
Hackety Hack is a free program for Windows, Mac OS X and Linux that can teach you how to make games, applications and more and share those programs with your friends. You can ask other budding programmers questions and follow them to see what code they're working on through the Hackety Hack website.
Sign up
Learn More
# Prompt user for number of entries and store value
input = ask "How many numbers will be averaged?"
numbers = input.to_i
# Pre-defined float value that will be used to sum and average values
avg = 0.0
# Accept all values and sum together
numbers.times do
input = ask "Input a number to be averaged:"
num = input.to_i
avg = avg + num
end
# Calculate the average
avg = avg / numbers
# Ouput the result
alert "The average of the numbers is " + avg.to_s + "."