hi .
plz I need you to explain for me how i can write a function that return the mod of array with n value .
i think mod is that sample mode is it ?
i am try to solve .
but my code print the number taht is repeted not mode
#include<iostream.h>
void main()
{
int array[12]={8,9,6,7,5,7,3,5,2,5,8,9};
int sentinel=array[0];
cout<<sentinel;
for ( int i=1;i<12;i++)
{
if (sentinel<array[i])
sentinel=array[i];
}
sentinel++;
cout<<sentinel;
cout<<":::\n";
for ( i=1;i<12;i++)
{
if (array[i]!=sentinel)
{
// int count =1;
int value=array[i];
array[i]=sentinel;
int j=i+1;
while(j<12)
{
if (array[j]==value)
{
i++;
array[j]=sentinel;
}
j++;
}
cout <<value<<"\t"<<"\n";
}
}
}
i just need The most frequent number ?
in that way i am understant the question >
what is the mod ?