This program takes an array of size N and a number and searches its presence in the array.
- In the first line, there will be a single integer N, describing the no of elements that you want to have in the array.
- From second line, there will be space for entering the values of the array.
- Next you need to enter the element you want to search for in the array.
Firstly, the array you have created is displayed. Next, the arranged values in ascending order is displayed. Finally, the search result is displayed, i.e, whether the search was successful or not.
Enter no of items in the list: 5
Enter the value: 3
Enter the value: 6
Enter the value: 2
Enter the value: 9
Enter the value: 1
Enter the value to search: 4
The list you entered is: [3, 6, 2, 9, 1]
The sorted list is: [1, 2, 3, 6, 9]
Search unsuccessful.