Design a program that gives simple math quizzes. The program should display two random numbers that are to be added, such as: 247 + 129 The program should allow the student to enter the answer. If the answer is correct, a message of congratulations should be displayed. If the answer is incorrect, a message showing the correct answer should be

Respuesta :

Answer:

import random

num1 = random.randint(0, 1000)

num2 = random.randint(0, 1000)

print(str(num1) + " + " + str(num2) + " = ?")

result = int(input("Enter the answer: "))

if result == (num1 + num2):

   print("Congratulations!")

else:

   print("The correct answer is: " + str(num1 + num2))

Explanation:

*The code is in Python.

Import the random to be able to generate random numbers

Generate two numbers, num1 and num2, between 0 and 1000

Ask the sum of the num1 and num2

Get the input from the user

If the answer is correct, display a message of congratulations. Otherwise, display the correct answer