Read an integer N.
This number indicates how many values the array will have.
Then, read N integers (one per line) and store them in an array.
The array is guaranteed to be sorted in ascending order.
Finally, read another integer k and search for k in the array.
Since the array is sorted, you can optimize the search: if arr[i] > k, you can stop (break) because all following elements will also be greater than k.
Hints:
for loop to read the data and store it in the array.for loop to search. If arr[i] > k, use break to stop early.k is not found, display the appropriate message.An integer N, followed by N integers (sorted ascending), one per line, followed by an integer k.
If k is found, display Posicion {index} (0-based position).
If k is not found, display No encontrado.
Input:
5
1
3
5
7
9
5
Output:
Posicion 2