Created
August 10, 2021 21:05
-
-
Save mahmmoudkinawy/c211c2198f034d774b6dbd533c32d814 to your computer and use it in GitHub Desktop.
Mahmmoud Hisham's Task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scanner scan = new Scanner(System.in); | |
ArrayList<Integer> list = new ArrayList<>(); | |
System.out.print("Enter Number of records you wanna add to ArrayList: "); | |
int num = scan.nextInt(); | |
for (int i = 0; i < num; i++) | |
list.add(scan.nextInt()); | |
System.out.print("Enter Number to search is exist or not :"); | |
int n = scan.nextInt(); | |
System.err.println(list.contains(n) ? "Found" : "Not Found"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment