Results 1 to 6 of 6

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

  1. #1
    Junior Member
    Join Date
    Aug 2007
    Answers
    11

    Smile how can i find out duplcate numbers in an array?

    how can i find out duplcate numbers in an array?


  2. #2
    Junior Member
    Join Date
    Nov 2007
    Answers
    3

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

    Put the array elements in a set.


  3. #3
    Contributing Member
    Join Date
    Nov 2007
    Answers
    46

    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. #4
    Junior Member
    Join Date
    Aug 2007
    Answers
    11

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

    Quote Originally Posted by rahulvegi View Post
    i want one clarification from you

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


  5. #5
    Contributing Member
    Join Date
    Nov 2007
    Answers
    46

    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. #6
    Junior Member
    Join Date
    Dec 2007
    Answers
    12

    Post 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.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact