← Back

Code Challenge 3.5 - Count Occurrences


Objective

Count how many times a specific value occurs in an array.

Skills to Practice

Challenge Tasks

Lists

You may complete this code challenge using a list.

Sample Output

Enter the size of your collection: 6 [Enter]
Enter element 1: 5 [Enter]
Enter element 2: 3 [Enter]
Enter element 3: 5 [Enter]
Enter element 4: 7 [Enter]
Enter element 5: 5 [Enter]
Enter element 6: 8 [Enter]

Enter the value to count: 5 [Enter]
The value 5 appears 3 times in the collection.