Final answer:
The question asks for a program that finds the largest nonnegative number entered by a user, which stops taking input upon entry of 0 or a negative number. A Python example provided demonstrates this functionality using a while loop and conditional statements.
Step-by-step explanation:
The student is asking how to create a program that continuously prompts the user to enter numbers and determines the largest nonnegative number entered. When the user enters 0 or a negative number, the program should display the largest number input before that point. Below is a simple example in Python:
max_number = float('-inf')
while True:
number = float(input('Enter a number: '))
if number <= 0:
break
if number > max_number:
max_number = number
if max_number == float('-inf'):
print('No positive numbers were entered.')
else:
print('The largest number entered was', max_number)
This script uses a while loop to ask the user for inputs and updates the max_number variable whenever a larger number is found. The loop breaks when a non-positive number is entered, and the program then displays the largest number found.