numarul care se repeta de cel mai multe ori in vector
Se citeste un vector de componente numere intregi pozitive. Sa se afiseze numarul care se repeta de cel mai multe ori in vector. #include <iostream> using namespace std; int main() { int aux,n,i,j,nr,m,max,y,a[20],v[20]; cout<<“n=”;cin>>n; for (i=0;i<n;i++) {cout<<“a[“<<i<<“]=”;cin>>a[i];} aux=-1; max=a[0]; for(i=1;i<n;i++) if(max<a[i]) max=a[i]; m=max; for(i=0;i<m;i++) v[i]=0; for(i=0;i<n-1;i++) {nr=1; y=a[i]; if(y!=aux) for(j=i+1;j<n;j++) if(y==a[j]) { nr++;a[j]=aux; } … Read more