Final answer:
To write a program that counts the occurrences of integers between 1 and 100, use an array to store the count for each number. Iterate over the input numbers, convert them to integers, and increment the count in the array. Finally, print out the numbers and their counts.
Step-by-step explanation:
To write a program that counts the occurrences of integers between 1 and 100, you can use an array to store the count for each number. Here's an example program in Python:
counts = [0] * 101
nums = input('Enter integers between 1 and 100: ').split()
for num in nums:
num = int(num)
counts[num] += 1
for i in range(1, 101):
if counts[i] > 0:
print(i, 'occurs', counts[i], 'times')
This program initializes an array called counts with 101 zeros (one for each number between 1 and 100). It then reads a list of numbers from the user input, converts each number to an integer, and increments the count in the count's array accordingly. Finally, it iterates over the counts array and prints out the numbers and their respective counts if the count is greater than zero.