Answer:
The programming language is not stated;
However, the program in python is as follows;
mylist = []
user_input = int(input("Input: "))
while not user_input == 0:
if 1<=user_input<=50:
mylist.append(user_input)
user_input = int(input("Input: "))
for i in range(1,51):
if i in mylist:
print(str(i)+" occured "+str(mylist.count(i))+" times")
Step-by-step explanation:
This line creates an empty list
mylist = []
This line gets input from the user
user_input = int(input("Input: "))
This line begins an iteration that checks if user input is not 0
while not user_input == 0:
This if condition checks if user input is within range of 1 to 50
if 1<=user_input<=50:
If both conditions are true, the user input is appended to the list
mylist.append(user_input)
This line gets another input from the user
user_input = int(input("Input: "))
This following loop prints the occurrence of each number in the list
for i in range(1,51):
if i in mylist:
print(str(i)+" occured "+str(mylist.count(i))+" times")