Interview Questions and Answers :: Accenture
Home > Experience Archives > Accenture > Interview Question Set > Discussion
31. Write the program to find the duplicate numbers and its count in an array.
Answer:
int a[]= {2,3,4,7,9,3,8,9,6,8,7,9};
int i=0;
int j=0;
int flag=0;
int n=12;
static int incr;
for (i=0;i
for(j=0;j
if (a[i]==a[j])
{
incr++;
if (incr>=2)
flag=1;
}
}
if (flag)
printf("\n %d is repeated %d times in this array", a[i],incr);
flag=0;
incr=0;
}
Ramya
13 Jul, 2017 10:20 PM
int a[]= {2,3,4,7,9,3,8,9,6,8,7,9};
int i=0;
int j=0;
int flag=0;
int n=12;
static int incr;
for (i=0;i
{
for(j=0;j
{
if (a[i]==a[j])
{
incr++;
if (incr>=2)
flag=1;
}
}
if (flag)
printf("\n %d is repeated %d times in this array", a[i],incr);
flag=0;
incr=0;
}
int i=0;
int j=0;
int flag=0;
int n=12;
static int incr;
for (i=0;i
for(j=0;j
if (a[i]==a[j])
{
incr++;
if (incr>=2)
flag=1;
}
}
if (flag)
printf("\n %d is repeated %d times in this array", a[i],incr);
flag=0;
incr=0;
}
Report Error
Report Error
Please Login First Click Here