Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- int mostOccurring(int *arr, int n, int *countPtr);
- int mostOccurring(int *arr, int n, int *countPtr)
- {
- int count[10] = { 0 }, i, max;
- for (i = 0; i < n; i++)
- count[arr[i]]++;
- max = 0;
- *countPtr = count[0];
- for (i = 1; i < 10; i++)
- if (count[i] > count[max]) {
- max = i;
- *countPtr = count[max];
- }
- return max;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement