CJCoding With Joseph

Check if All Elements Are Positive

The array {4, 9, 2, 7, 1} is given. Print true if every element is strictly greater than 0, and false otherwise:

true

All five elements are positive, so the answer is true. Start by assuming the result is true and set it to false as soon as you find a non-positive element.

Expected Output:

true
Topics:
Arrays
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (sysout, psvm, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.