Linear Search
EasyRead an integer N, then N integers into an array, then a key. Search the array from the first element and print key 4 found at index 2 with the key and the zero-based index of its first occurrence, or key 9 not found if it is absent. Start a result variable at -1, set it to the index at the first match and leave the loop with break, and let that variable alone decide which line to print. N must be between 1 and 100; otherwise print N must be between 1 and 100 and return 1. If N, any value, or the key cannot be read, print invalid input and return 1.
Success Criteria
Your code must pass 7 test case(s) to complete this exercise. 3 hint(s) are available if you need help.
Sign in to track your progress
You can work on exercises as a guest, but sign in to track your progress and save your submissions.
How did you find this exercise?
Your rating helps us improve the content.