solution int flag =0; int index =-1; for(int i=0; i<N; i++){ if(arr[i]==X){ flag =1; index = i+1; if(flag==1){ System.out.print(index + " "); } else{ System.out.print("-1"); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)