Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class sample {
- public static void main(String[] args){
- System.out.println("Enter a set of integers to add to the list, and enter 0 when done to begin program: ");
- int number = IO.readInt();
- int counte = 0;
- int counto = 0;
- while(number != 0){
- if(number ==0){
- break;
- }
- if(number % 2 == 0){
- counte = counte + 1;
- number = IO.readInt();
- }else{
- counto = counto + 1;
- number = IO.readInt();
- }
- }
- System.out.println("The total number of even numbers is: " + counte);
- System.out.println("The total number of odd numbers is: " + counto);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement