for which case our code MAXCOUNT is given wrong answer,plz help code is given below

#include<stdio.h>
#include
using namespace std;
int main()
{
int i,t,n,max,n1,c,a[100];
scanf("%d",&t);
while(t–){
scanf("%d",&n);
max=0;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
sort(a,a+n);
for(i=0;i<n;i++){
if(i==0){
c=1;
}
else if(a[i]==a[i-1]){
c++;
}
else if(c>max){
max=c;
n1=a[i-1];
c=1;
}
else{
c=1;}
}
printf("%d %d\n",n1,max);
}
return 0;
}

Use Counting Sort

@aichemzee nice link…

//