-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSortSearch.java
More file actions
40 lines (29 loc) · 757 Bytes
/
SortSearch.java
File metadata and controls
40 lines (29 loc) · 757 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
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class SortSearch
{
public static void main(String[] args)
{
//System.out.println("Enter element to be searched : ");
Scanner in = new Scanner(System.in);
int v = in.nextInt();
//System.out.println("Input Arr Size : ");
int n = in.nextInt();
//enter elements into array
int arr[] = new int[n];
for(int arr_i=0; arr_i < n; arr_i++)
{
arr[arr_i] = in.nextInt();
}
for(int i=0 ; i<n ; i++)
{
if(arr[i]==v)
{
System.out.print (i);
}
}
}
}