i want you to help me to find the mode in array size n
if there two element have same number of repetion there is no mode .
mode :: the most number is repeted .
e.g
{1,2,3,4,3}
the mode is 3
but if we have {1,2,3,1,3}
there is no mode because 3=1 with number of reption .
my code have two function
first is to sort the array and other function to chick if there a mode or not ..
#include <iostream.h>
void bubble_sort(int Array[ ],int ,int );
void main()
{int n_elements,temp=0,Array[50];
cout<<"How many elements ? ";
cin>>n_elements;
cout<<"Enter the elements:-\n";
for(int i=0;i<n_elements;i++)
cin>>Array[i];
bubble_sort(Array,n_elements,temp);
}
void bubble_sort(int Array[],int n_elements,int temp)
{
for(int i=0;i<n_elements;i++)
{
for(int j=0;j<n_elements;j++)
{
if (Array [i]<Array[j]){
temp=Array[i];
Array[i]=Array[j];
Array[j]=temp;
}
}
}
for( i=0;i<n_elements;i++)
cout<<Array[i]<<" ";}
}
how i can write function to chick .??