Largest Value and Its Index
mediumQuestion 224Finding the maximum is useful, but often you also want to know WHERE it is. This exercise combines two things to track: the largest value seen so far, and the index at which it was found. Start both from element 0. As you loop, whenever you find a bigger value, update the max AND record the current index. Finally print a line in the exact form: Max <value> at index <index>.
Expected output
Max 89 at index 3= newline. No newline after the last line.
Hints4 available
Sign in to use hintsTopics
Arrays
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.