Answers for "fetching even items from a list java"

0

fetching even items from a list java

public class OddEvenInArrayExample{  
public static void main(String args[]){  
int a[]={1,2,5,6,3,2};  
System.out.println("Odd Numbers:");  
for(int i=0;i<a.length;i++){  
if(a[i]%2!=0){  
System.out.println(a[i]);  
}  
}  
System.out.println("Even Numbers:");  
for(int i=0;i<a.length;i++){  
if(a[i]%2==0){  
System.out.println(a[i]);  
}  
}  
}} 
Posted by: Guest on November-14-2020

Code answers related to "fetching even items from a list java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language