duplicate element in array 



package com.company;
import java.util.*;

public class Main {

public static void main(String[] args) {
// sum of subarray
Scanner sc = new Scanner(System.in);
int a[]={-2,-3,4,-1,-2,1,5,-3};
for(int i=0;i<a.length;i++){
for(int j=0;j<a.length;j++){
if(a[i]==a[j]){
System.out.println(true);
break;
}
else{
System.out.println(false);
break;
}
}
}

}





}

Comments

Popular posts from this blog

Discover the Best Steel Manufacturer: Adnan & Sons

Online Cabinets and Lockers in Pakistan: Discover Adnan & Sons' Top-Quality Steel Products

The Best Emergency Exit Door in Pakistan by Adnan & Sons