CJCoding With Joseph
15per day

Find Index of Minimum

An array called nums has already been created for you with the values {30, 10, 50, 20, 40}.

Your task is to find and print the index (position) of the smallest element in the array.

This is similar to finding the smallest value, but instead of just tracking the value, you also need to track which index it was found at. Use a variable to remember the index of the minimum value as you loop through.

The smallest value is 10, which is at index 1.

Print the result in this exact format:
Min index: 1

Expected Output:

Min index: 1
Topics:
Arrays
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.