import java.util.*;
import java.lang.*;
import java.io.*;
// The main method must be in a class named "Main".
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
System.out.println("find element in array\n write a number");
int user = sc.nextInt();
int [] arr = { 22,33,45,66,78,89};
int arrlen = arr.length;
for (int a=0 ; a<arrlen ; a++)
{
System.out.println(arr[a]);
if (user==arr[a])
{
System.out.println("present in the array");
//break;
System.exit(0);
}
}
System.out.println("not present in the array");
}
}
To embed this program on your website, copy the following code and paste it into your website's HTML: