Click the Twitter icon to follow our tweets and
know more about us.

WAP to fill an array and then remove the repeated digits without using another array.

import java.io.*;
class array
{
     public static void main()throws IOException
     {
         DataInputStream k=new DataInputStream(System.in);
         int a[]=new int[10];
         int b[]=new int[100];
         System.out.println("Fill The Array");
         for(int i=0;i<10;i++)
         a[i]=Integer.parseInt(k.readLine());
         for(int i=0;i<10;i++)
         b[a[i]]=a[i];
         for(int i=0;i<100;i++)
         if(b[i]!=0)
         System.out.println(b[i]);
     }
}

Comments (0)

Post a Comment