Question: Question 2 options: Given the following Java program fragment Scanner console = new Scanner(System.in); int i; int count; int evenSum; int oddSum; i = 0;
Question 2 options: Given the following Java program fragment Scanner console = new Scanner(System.in); int i; int count; int evenSum; int oddSum; i = 0; evenSum = 0; oddSum = 0; count = console.nextInt(); do { i = console.nextInt(); if (i < 0) { break; } if (i == 0) { continue; } if ((i % 2) == 0) { evenSum += i; } else { oddSum += i; } } while ((--count > 0) && (i < 10)); and the following input values -1 4 3 2 1 what's the value of count? What's the value of evenSum? What's the value of oddSum? What's the value of i?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
