- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathL_Search.cpp
More file actions
Latest commit
41 lines (29 loc) · 519 Bytes
/
Copy pathL_Search.cpp
File metadata and controls
41 lines (29 loc) · 519 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
#include<iostream>
usingnamespacestd;
intL_Search (int a[], int x, int n)
{
int i;
for (i = 0; i < n; i++)
{
if (a[i] == x)
{
return i;
}
}
i = -1;
return i;
}
intmain()
{
int i,
int b[5];
cout << "Enter 5 elements of the array: ";
for (i = 0; i < 5; i++)
{
cin >> b[i];
}
int num;
cout << "Enter element to search: ";
cin >> num;
L_Search(b[i], num);
}