Search⌘ K

Addition Quiz Game

Explore creating an addition quiz game in Ruby that prompts users with random single-digit questions. Learn to generate random numbers, use loops for repeated tasks, handle user input, provide feedback, and maintain a scoring system across ten questions.

Problem

Write a program that prompts 10 single-digit addition questions for the user to answer, provides feedback based on user’s response, and prints out the user's score.

1 + 1 = (enter 2) Correct.
2 + 7 = (enter 8) Wrong!
...
6 + 3 =
Your score: 8/10
Demo of addition quiz game

Purpose

  • Use rand() to generate a random number ...