Final answer:
To solve this problem, you can create a program that takes input from the user until a negative integer is entered and calculate the average and maximum.
Step-by-step explanation:
To solve this problem, you can create a program that takes input from the user until a negative integer is entered. Then, calculate the average and maximum of the non-negative integers entered. Here is a Python example:
x = int(input())
numbers = []
while x >= 0:
numbers.append(x)
x = int(input())
average = sum(numbers) / len(numbers)
maximum = max(numbers)
print(average, maximum)
In this program, we use a while loop to collect input numbers until a negative number is entered. Then, we calculate the average using the sum() and len() functions, and the maximum using the max() function. Finally, we print the average and maximum.