Smallest Element in an Array
easyQuestion 219Finding the smallest value works just like finding the largest, but you flip the comparison. Assume the first element is the smallest so far, then scan the rest of the array and keep any value that is smaller than your current minimum. When the loop ends you have the smallest number. Print 'Min: ' followed by that value.
Expected output
Min: 2= 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.