forked from 790hanu/Annex-qr-code-simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Logic.java
37 lines (28 loc) · 828 Bytes
/
Logic.java
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
30
31
32
33
34
35
36
37
import java.util.Scanner;
import javax.lang.model.util.ElementScanner14;
class Logic
{
public static boolean Liner_Searh(int[]A,int target)
{
int i=0;
while(i<A.length && A[i]!=target)
i++;
if(i<A.length)
return true;
else
return false;
}
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter How many Elements:");
int n=sc.nextInt();
int[]A=new int[n];
System.out.println("Enter Digits:");
for(int i=0;i<A.length;i++)
A[i]=sc.nextInt();
System.out.println("Enter Target");
int target=sc.nextInt();
System.out.println(Liner_Searh(A, target));
}
}