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.
Finally, read another integer k and check whether k exists in the array.
Display only SI if it exists, or NO if it does not.
Hints:
for loop to read the data and store it in the array.bool variable to track whether k was found.break to stop searching once found.An integer N, followed by N integers, one per line, followed by an integer k.
SI if k exists in the array, otherwise NO.
Input:
5
3
7
1
9
5
9
Output:
SI
Input:
5
3
7
1
9
5
2
Output:
NO