package com.tutorial4u;
public class RemoveDuplicate {
public static void main(String[] args) {
int array[] = {1,2,2,3,4,4,5,6,6,7};
for(int i=0;i<array.length;i++){
for(int j=i+1;j<array.length;j++){
if(array[i]==array[j]){
i++;
j=i+1;
}
}
System.out.print(" "+array[i]);
}
}
}
Output:
No comments:
Post a Comment