- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDetect_Array.java
More file actions
Latest commit
27 lines (25 loc) · 780 Bytes
/
Copy pathDetect_Array.java
File metadata and controls
27 lines (25 loc) · 780 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
packagecom.company;
importjava.util.Scanner;
publicclassDetect_Array {
publicstaticvoidmain(String[] args) {
float [] marks = {45.7f, 67.8f, 63.4f, 99.2f, 100.0f};
Scannersc=newScanner(System.in);
System.out.println("Please Enter Valid marks : ");
floatnum=sc.nextFloat();
booleanisArray=false;
for (floatelement:marks) {
if (num==element)
{
isArray=true;
break;
}
}
if (isArray)
{
System.out.println("The value is present in the array");
}
else {
System.out.println("The value is not present in the array");
}
}
}