fork download
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. Scanner sc= new Scanner(System.in);
  6. int size=sc.nextInt();
  7. int[] array=new int[size];
  8. for(int i=0;i<size;i++){
  9. array[i]=sc.nextInt();
  10. }
  11. int x=sc.nextInt();
  12. for(int i=0;i<array.length;i++){
  13. if(x==array[i]){
  14. System.out.print("value found at "+ array[i]);
  15. }
  16. }
  17. }
  18.  
  19. }
Success #stdin #stdout 0.2s 59060KB
stdin
5
1
2
3
4
5
2
stdout
value found at 2