Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

get odd number in array

public int[] findEvens() {
  int numberEvens = 0;
  for (int i = 0; i < numbers.length; i++) {
     if (numbers[i] % 2 == 0) {
        numberEvens++;
     }
  }
Comment

get odd number in array

public int[] findEvens() {
  int numberEvens = 0;
  for (int i = 0; i < numbers.length; i++) {
     if (i % 2 == 0) {
        numberEvens++;
     }
  }
Comment

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");
        }
    }
Comment

Even numbers in an array

const evenNumbers = (array, number) => array.filter(item => item % 2 === 0).slice(-number);
Comment

PREVIOUS NEXT
Code Example
Java :: java create array 
Java :: where to use findviewbyid in fragment 
Java :: final keyword in java 
Java :: create thread java 
Java :: how to make window in java 
Java :: how to get string value in java in android 
Java :: how to change background color of grid in grid layout in android 
Java :: hibernate onetone with mapsid 
Java :: java stream add to existing list 
Java :: while loops java 
Java :: java packages example 
Java :: Java if...else Statement 
Java :: java.lang.classcastexception: java.lang.string cannot be cast to java.util.arraylist 
Java :: what is java 
Java :: import image icon 
Java :: Set icon for toolbar android 
Java :: limit decimals java 
Java :: edittext editable false android java 
Java :: how to use Add Grepper Answer (a) 
Java :: recyclerview adapter multiple view types 
Java :: iterate through arraylist java 
Java :: java append to array 
Java :: Java Iterating through LinkedList 
Java :: valid parentheses leetcode solution java 
Java :: buy and sell stock 
Java :: for loop in java 
Java :: int to integer array in java 
Java :: exoplayer how to put loader while video is still loading android java 
Java :: first none duplicated char 
Java :: view binding 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =