JAVA - How To Find Primitive And Pairs Numbers From Int Array In Java NetBeans
__________________________________________________________________________
In This Java Code We Will See How To Find The Primitive Numbers Or The Pairs Numbers From An Int Array In Java Programming Language.
Source Code:
package javaapp;
public class Woirk{
public static void main(String[] args){
int[] ns = {2,54,3,24,5,23,76,13,10,19,88,41};
//get pairs numbers
System.out.println("List Of Pairs Numbers");
for(int i = 0; i < ns.length; i++){
if(ns[i]%2 == 0)
System.out.println(ns[i]);
}
System.out.println("________");
//get Primitive numbers
System.out.println("List Of Primitive Numbers");
for(int i = 0; i < ns.length; i++){
if(ns[i]%2 != 0)
System.out.println(ns[i]);
}
}
}
/////////OUTPUT:
List Of Pairs Numbers
2
54
24
76
10
88
________
List Of Primitive Numbers
3
5
23
13
19
41
In This Java Code We Will See How To Find The Primitive Numbers Or The Pairs Numbers From An Int Array In Java Programming Language.
Source Code:
package javaapp;
public class Woirk{
public static void main(String[] args){
int[] ns = {2,54,3,24,5,23,76,13,10,19,88,41};
//get pairs numbers
System.out.println("List Of Pairs Numbers");
for(int i = 0; i < ns.length; i++){
if(ns[i]%2 == 0)
System.out.println(ns[i]);
}
System.out.println("________");
//get Primitive numbers
System.out.println("List Of Primitive Numbers");
for(int i = 0; i < ns.length; i++){
if(ns[i]%2 != 0)
System.out.println(ns[i]);
}
}
}
/////////OUTPUT:
List Of Pairs Numbers
2
54
24
76
10
88
________
List Of Primitive Numbers
3
5
23
13
19
41