Assume n is the number of elements in list[]

int Mode(int n, list[])

{

int i, j, mode, freq;

maxfreq = 1;

for (i=0; i < n; i++)

{

freq = 1;

for (j=i+1; j < n; j++)

{

if (list[i] == list[j])

freq++;

}

if (freq > maxfreq) {

maxfreq = freq ;

mode = list[i];

}

}

return mode;

}

int Mode(int n, list[])

{

int i, j, mode, freq;

maxfreq = 1;

for (i=0; i < n; i++)

{

freq = 1;

for (j=i+1; j < n; j++)

{

if (list[i] == list[j])

freq++;

}

if (freq > maxfreq) {

maxfreq = freq ;

mode = list[i];

}

}

return mode;

}