Skip to content

Commit c2f9b01

Browse files
Add files via upload
1 parent eaeba97 commit c2f9b01

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Searching.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import java.util.*;
2+
public class Searching {
3+
public static void main(String[]args){
4+
Scanner sc=new Scanner(System.in);
5+
System.out.println("enter the number of the array :");
6+
int num=sc.nextInt();
7+
System.out.println("enter the numbers in the array :");
8+
int a[]=new int[num];
9+
for(int i=0;i<a.length;i++){
10+
a[i]=sc.nextInt();
11+
}
12+
System.out.println("enter the desired number u want to find.");
13+
int t=sc.nextInt();
14+
for(int l=0;l<a.length;l++){
15+
if(a[l]==t){
16+
System.out.println("desired number is found.");
17+
return;
18+
}
19+
}
20+
21+
System.out.println("desired number is not found.");
22+
23+
}
24+
25+
}
26+

0 commit comments

Comments
 (0)