class remDup
{
public static void main(String args[]) throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the length of the array: ");
int l=Integer.parseInt(br.readLine());
int[]a=new int[l];
for(int i=0; i
System.out.print("Enter the element number "+(i+1)+" of the array: ");
a[i]=Integer.parseInt(br.readLine());
}
//now the real work begins
for(int i=0; i
for(int j=i+1; j
while(a[i]==a[j])
{
for(int A=j; A
l--;
}
}
}
// real work is done now!!!!
for(int i=0; i
System.out.println(a[i]);
}
}// end of main
}// end of class
You can also check here
ReplyDeletehttp://javaarcade.blogspot.in/2013/10/program-to-remove-duplicates-from-array_9265.html