-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinSen.java
More file actions
41 lines (41 loc) · 822 Bytes
/
Copy pathLinSen.java
File metadata and controls
41 lines (41 loc) · 822 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
30
31
32
33
34
35
36
37
38
39
40
41
import java.io.DataInputStream;
class linear
{
int a[]=new int[5];
int n,se;
void input() throws Exception
{
DataInputStream d=new DataInputStream(System.in);
System.out.println("enter n elements:");
n=Integer.parseInt(d.readLine());
System.out.println("enter elements one by one:");
for(int i=0;i<n;i++)
{
a[i]=Integer.parseInt(d.readLine());
}
System.out.println("enter search element:");
se=Integer.parseInt(d.readLine());
}
void logic()
{
int c=0;
for(int i=0;i<n;i++)
{
if(se==a[i])
c++;
}
if(c>0)
System.out.println("ssss");
else
System.out.println("no");
}
}
class m
{
public static void main(String a1[])throws Exception
{
linear l=new linear();
l.input();
l.logic();
}
}