Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to find odd and even in a array

 public static void main(String[] args) {
        int[] xr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
        for (int i = 0; i < xr.length; i++) {
            System.out.println(xr[i] % 2 == 0 ? xr[i] + " -> even" : xr[i] + " -> odd");
        }
    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #find #odd #array
ADD COMMENT
Topic
Name
4+5 =