Skip to content

Instantly share code, notes, and snippets.

@atg
Created February 13, 2010 15:34
Show Gist options
  • Save atg/303501 to your computer and use it in GitHub Desktop.
Save atg/303501 to your computer and use it in GitHub Desktop.
# Trabb-Pardo Knuth
def f(x)
return Math.sqrt(x.abs) + 5*x ** 3
end
Array.new(11) { gets.to_i }.reverse.each do |x|
y = f(x)
if y > 400
puts "#{x} TOO LARGE"
else
puts "#{x} #{y}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment