Skip to content

Instantly share code, notes, and snippets.

Created June 12, 2015 14:42
Show Gist options
  • Save anonymous/c422364d691147338007 to your computer and use it in GitHub Desktop.
Save anonymous/c422364d691147338007 to your computer and use it in GitHub Desktop.
puts "Welcome to a math quiz! "
puts "Lets start! "
counter = 0
puts "What is 2 + 2? "
user_input = gets.chomp.to_i
if user_input == 4
counter += 1
puts "Correct answer! "
elsif
puts "Wrong answer! "
end
puts "What its 3 x 3? "
user_input1 = gets.chomp.to_i
if user_input1 == 9
counter += 1
puts "Correct answer! "
elsif
puts "Wrong answer! "
end
puts "What is 4**3"
user_input2 = gets.chomp.to_i
if user_input2 == 64
counter += 1
puts "Correct answer! "
elsif
puts "Wrong answer! "
end
puts "Whats 225 / 5? "
user_input3 = gets.chomp.to_i
if user_input3 == 45
counter += 1
puts "Correct answer! "
elsif
puts "Wrong answer! "
end
puts "total correct answers: #{counter}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment