Java program to find the element in the array

import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(; System.out.println("Enter +ve array size"); int n=sc.nextInt(); int arr[]=new int[n]; int pos=0; System.out.println("Enter array elements"); for(int i=0;i<n;i++) { arr[i]=sc.nextInt(); } System.out.println("Enter elements to find out in array"); int a=sc.nextInt(); boolean flag = false; for (int num : arr) { if (num == a) { flag = true; pos++; break; } } if(flag) System.out.println("Element is "+a+" found at position "+pos); else System.out.println("Element not found"); } }