-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patharray.java
More file actions
30 lines (21 loc) · 716 Bytes
/
array.java
File metadata and controls
30 lines (21 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.util.Scanner;
// Program to check the entered number found in the array
public class array {
public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
int[] Numlist={4,8,5,91,58,67};
System.out.println("Enter the number please");
int Num=scan.nextInt();
scan.close();
String status="Notfound";
for(int number:Numlist){
if(number==Num){
System.out.println("Number is found in list ");
status="found";
}
}
if(status=="Notfound"){
System.out.println("Number is not found in list ");
}
}
}