Question: Java Programming Topic: Loops Question: How many times are the following loop bodies repeated? What is the output of each loop? Please show the algorithm
Java Programming
Topic: Loops
Question: How many times are the following loop bodies repeated? What is the output of each loop?
Please show the algorithm (input, steps, and output) and be detailed in the comments. Thank you!
(a) int i = 1; while (i < 10) if (i % 2 == 0) System.out.println(i); (b) int i = 1; while (i < 10) if (i % 2 == 0) System.out.println(i++); (c) int i = 1; while (i < 10) if ((i++) % 2 == 0) System.out.println(i);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
