Sum.Write a program that prompts the user to read two integers and displays their sum.Your program should prompt the user to read the number again if the input is incorrect.

Respuesta :

Answer:

while True:

   number1 = input("Enter the number1: ")

   number2 = input("Enter the number2: ")

   

   if number1.isnumeric() and number2.isnumeric():

       break

 

number1 = int(number1)

number2 = int(number2)

print("The sum is: " + str(number1 + number2))

Explanation:

*The code is in Python.

Create an infinite while loop. Inside the loop, Get the number1 and number2 from the user. Check if they are both numeric values. If they are, stop the loop (Otherwise, the program keeps asking for the numbers).

When the loop is done, convert the numbers to integer numbers

Calculate and print their sum

ACCESS MORE
EDU ACCESS