Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- class oddAndEven{
- public static void main(String [] args){
- ArrayList<Integer> odd = new ArrayList<Integer>();
- ArrayList<Integer> even = new ArrayList<Integer>();
- while(!Console.EndOfFile()){
- int tmp = Console.readInt();
- if(tmp%2==0){
- even.add(tmp);
- }
- else {
- odd.add(tmp);
- }
- }
- for(int a: even){
- System.out.print(a + " " );
- }
- System.out.println(" ");
- for(int b: odd){
- System.out.print(b + " " );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment