Initialize two integer variabl

SoccerBoss
Category:
Programming
Price: $5 USD

Question description

Initialize two integer variables and set them to zero. Then continuing with programming assignment #3, loop through each item in the array and do a calculation to determine if the number is even or odd (using the modulus operator). Using a switch statement, increment one variable for all even numbers and do the same for the other variable for any odd numbers (using the increment operator).

Output the total number of even and off numbers to the screen.

 Example output:

34

53

125

854

8

1045

66

9434

5205

235

There are 5 even numbers.

There are 5 odd numbers.


Tutor Answer

(Top Tutor) Daniel C.
(997)
School: Cornell University
PREMIUM TUTOR
Studypool has helped 1,244,100 students
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1831 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors