Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package chapterSix;
- import java.util.Scanner;
- public class IntegerReaders
- {
- public static void main(String[] args)
- {
- Scanner s = new Scanner (System.in);
- System.out.println("Inputs:");
- int evens = 0;
- int odds = 0;
- while(s.hasNextInt())
- {
- int input = s.nextInt();
- if (input % 2 == 0)
- {
- evens++;
- }
- else
- {
- odds++;
- }
- }
- System.out.println("Number of odds:" + odds);
- System.out.println("Number of evens"+ evens);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement