I am trying to find the mode, or the number which occurs most often, of my array. This is the scores array, which is sorted:

So far I have gotten the program to count how many times there is a duplicate, which is 3 because 2400 occurs 3 times. But I haven't gotten the program to print outCode:820 987 1000 1020 1100 1200 1450 1550 1680 2352 2400 2400 2400whichof the numbers occurs 3 times.

Here is my incomplete code:

How can I modify this so that it will tell me that 2400 occurs 3 times?Code:int mode (int scores [], int n) { int counter = 0; for (int pass = 0; pass < n - 1; pass++) for (int count = pass + 1; count < n; count++) { if (scores [count] == scores [pass]) counter++; } file_out << counter; }