Untitled
unknown
java
7 months ago
402 B
4
Indexable
Never
public class Test { public static int oddOrPos (int []x) { int cnt = 0; for (int i = 0; i < x.length; i ++) { if (x[i] % 2 == 1 || x[i] > 0) { cnt ++; } } return cnt; } public static void main (String[] args) { int[] arr = {-3, -2, 0, 1, 4}; System.out.println(oddOrPos(arr)); } }
Leave a Comment