This program takes an array of size N and a number and checks if the number is present in the array.
- The input consists of three lines.
- In the first line, there will be a single integer N.
- In the second line, there will be N space separated integers.
- In the third line, there will be a single integer, i.e., the number to be searched for in the array
A single line containing the search result.
5
1 3 7 5 2
2
2 is present at index 4
Python Implementation:
The input consists of two lines-
- First Line contains space separated integers which are array elements
- In second line, there will be a single integer, i.e., the number to be searched in the array
A single line containing the search result.
5
1 3 7 5 2
2
2 is present at index 4