โ Back to Arrays
Question 392
Check if All Elements Are Positive
Check if All Elements Are Positive
The array{4, 9, 2, 7, 1}is given. Printtrueif every element is strictly greater than0, andfalseotherwise: true All five elements are positive, so the answer istrue. Start by assuming the result istrueand set it tofalseas 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.