← Back to Arrays
Question 106
Print Elements Greater Than 25
Print Elements Greater Than 25
An array called nums has already been created for you with the values {10, 20, 30, 40, 50}.
Your task is to use the for loop to print only the elements that are greater than 25. Each qualifying element should be printed on its own line.
Inside the loop, use an if statement to check whether nums[i] > 25. If it is, print that element. If it isn't, skip it and move on to the next one.
The elements greater than 25 are: 30, 40, and 50.Expected Output:
30 40 50
= 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 (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.