Find Duplicate Array in Turbo C

  • Find Duplicate No in a Array and count the quantity of duplication


    void main ()
    {
        int array1[7]={2, 3, 4, 2, 3, 5, 6};
        int duplist[7];
        int reptnum[7];
        int duplicate=0;
        int reptimes=0;
        int in=0;
        for (int a=0; a<7; a++)
        {
            printf("%d",array1[a]);
        }

        for(int b=0;b<7;b++)
        {
            for(int c=b+1;c<7;c++)
            {
                if(array1[b]==array1[c])
                {
      duplicate==1;
                    reptimes++;
                    
                }
           
            }
     if(duplicate==1)
     {
     duplist[in] = array1[b];
     reptnum[in] = reptimes;
     in++;

     duplicate = 0;
     reptimes = 0;
     }
        }
        if(in>0)
        {  
        printf("Duplicte No  |  Repeat Times \n");
         for(b=0; b<in; b++)
        {
         printf("%d           |  %d   \n",duplist[b],reptnum[b]);
         
     }
        }
        else
        {
        printf("No duplicates Found");
        }
    }

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

Top Posters Weekly

Optimum Creative