Created
June 12, 2015 14:42
-
-
Save anonymous/c422364d691147338007 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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