Westonci.ca is your go-to source for answers, with a community ready to provide accurate and timely information. Get expert answers to your questions quickly and accurately from our dedicated community of professionals. Get detailed and accurate answers to your questions from a dedicated community of experts on our Q&A platform.
Sagot :
Answer:
In Python:
loop = True
while(loop):
nm1 = float(input("Number 1: "))
nm2 = float(input("Number 2: "))
nm3 = float(input("Number 3: "))
if (nm1 >= 0 and nm2 >= 0 and nm3 >= 0):
result = nm2 * nm3 + nm1
print("Result: "+str(result))
loop = True
else:
print("All inputs must be greater than or equal to 0")
loop = True
Explanation:
First, we set the loop to True (a boolean variable)
loop = True
This while loop iterates, indefinitely
while(loop):
The next three lines prompt user for three numbers
nm1 = float(input("Number 1: "))
nm2 = float(input("Number 2: "))
nm3 = float(input("Number 3: "))
The following if condition checks if all of the numbers are greater than or equal to 0
if (nm1 >= 0 and nm2 >= 0 and nm3 >= 0):
If yes, the result is calculated
result = nm2 * nm3 + nm1
... and printed
print("Result: "+str(result))
The loop is then set to true
loop = True
else:
If otherwise, the user is prompted to enter valid inputs
print("All inputs must be greater than or equal to 0")
The loop is then set to true
loop = True
Thank you for your visit. We are dedicated to helping you find the information you need, whenever you need it. Thanks for using our service. We're always here to provide accurate and up-to-date answers to all your queries. Thank you for choosing Westonci.ca as your information source. We look forward to your next visit.