Untitled
unknown
java
2 years ago
402 B
10
Indexable
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));
}
}Editor is loading...
Leave a Comment