Final answer:
To write a program that takes any number of integers as input and outputs the average and max, you can use a loop to continuously take input from the user until they indicate they're done entering numbers. After the loop, you can calculate the average by dividing the sum by the total number of integers entered.
Step-by-step explanation:
To write a program that takes any number of integers as input and outputs the average and max, you can use a loop to continuously take input from the user until they indicate they're done entering numbers. Within the loop, you can keep track of the sum of the numbers entered and the maximum number so far. After the loop, you can calculate the average by dividing the sum by the total number of integers entered. Here's an example program in Python:
sum = 0max_number = float('-inf')count = 0
while True:
num = input('Enter an integer (or done to finish): ')
if num == 'done':
break
num = int(num)
sum += num
count += 1
if num > max_number:
max_number = num
average = sum / count
print('Average:', average)print('Max:', max_number)