โ 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
50Expected Output:
30 40 50
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.