Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
561 B
1
Indexable
Never
#include <stdio.h>

int main() 
{
    int n,k,ar[99999]={0},max=0;

    printf("NUMBER OF ANIMALS N = ");
    scanf("%d",&n);
    int id[n];
    
    for(int i=0;i<n;i++)
    {
        printf("ENTER THE VALUE OF ID[%d] = ",i);
        scanf("%d",&id[i]);
        ar[id[i]]++;
    }
    
    for(int i=1;i<9999;i++)
    {
        if(ar[i]>max)
        max=ar[i];
    }
    
    for(int i=0;i<9999;i++)
    {
        if(ar[i]==max)
        {
            printf("\nTHE SMALLEST ID WITH MAXIMUM FREQUENCY = %d",i);
            break;
        }
    }
    return 0;
}