Okay, so I have been trying to figure this out for hours now and my teacher was no help. Here is the problem:
Your program should keep reading integer numbers from the user as long as the numbers are within [0, 9999], inclusive, i.e., as long as 0 <= number <= 9999. As you read these numberes, count how many of each number has occured. When the user enters a number outside of this boundary, you will print a summary of the input, showing the counts for only numbers that the user has entered at least once, from the smallest in the range.
You could use do{} while() loop. Inside you get number, check if it's inside boundary. If it is, then you could define an array of ints, size 10000, all set to 0. If number is valid, then you add 1 to array[number-1]. Otherwise, you print non-zero values of array. Or whole array. Depending on you.