Thread: how can i find out duplcate numbers in an array?

1. how can i find out duplcate numbers in an array?

how can i find out duplcate numbers in an array?

2. Re: how can i find out duplcate numbers in an array?

Put the array elements in a set.

3. Re: how can i find out duplcate numbers in an array?

i want one clarification from you

- it is normal array program or
- it is in collection frame work

4. Re: how can i find out duplcate numbers in an array?

Originally Posted by rahulvegi
i want one clarification from you

- it is normal array program or
- it is in collection frame work
normal array.

5. Re: how can i find out duplcate numbers in an array?

algorithm:

- create an array, which contains an elements (a[])
- create another array, which is used to assign values to that array (b[])
- now u will take loop and compare two array (if a[]==b[])
- now u will print that values

please try like this, if there is any problem i will give the program for you ok

6. Re: how can i find out duplcate numbers in an array?

int arr[10],arrDupEle[10];
int i,j,k;
printf("Enter 10 ele :");//consider array of 10 ele
for (i=0;i<10;i++)
scanf("%d",&arr[i]);
k=0;
for (i=0;i<10;i++)
{
for (j=0;j<10;j++)
{
if (i!=j)
{
if (arr[i]==arr[j])
{
arrDupEle[k++]=arr[i];
}
}
}
}
for (i=0;i<k;i++)/////or try i<k-1
printf("%d\t",arrDupEle[i]);

try this out...........

7.

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•