60 693
Assignments Done
Successfully Done
In April 2018

Answer to Question #15632 in C++ for Neeraj

Question #15632
Sir please help me to solve this question.
How to find a no repeated maximum times in an 1D array.
eg an array is 1,2,4,4,8,4,3,7,4,9,4
output should be 4
Expert's answer
#include <stdio.h>

#include <conio.h>

#define MAX 50


int array[MAX], n, i, j, tmp, repeat;

printf("Number of elements array = "); scanf("%i",&n);

printf("Type array elements:

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

printf("Array[%i] = ",i); scanf("%i",&array[i]);

if(array[i]==0) break;


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

tmp = 0;

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

if(array[i] < array[j]){

tmp = array[i];

array[i] = array[j];

array[j] = tmp;




printf("The result of sorting:

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

printf("%i ",array[i]);


Repeated elements:

for(i=0,tmp=0; i<n; i++){

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

if(array[i] == array[j]){


printf("%i %i ",array[i],array[j]);




if(tmp > 0){

The number of repetitions: %i",tmp);

} else printf("
The array elements is not repeated");


return 0;


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions