Compare and contrast the break and continue statements. Find and correct the error(s) in each of the following segments of code: a) For (i = 100 , i >= 1 , i++) System.out.println(i); b) The following...

Compare and contrast the break and continue statements.

Find and correct the error(s) in each of the following segments of code:


a)
For
(i =
100, i >=
1, i++)


System.out.println(i);


b) The following code should print whether integer value is odd or even:



switch
(value %
2)


{



case

0:


System.out.println("Even integer");



case

1:


System.out.println("Odd integer");


}


c) The following code should output the odd integers from 19 to 1:



for
(i =
19; i >=
1; i +=
2)


System.out.println(i);


d) The following code should output the even integers from 2 to 100:


counter =
2;



do


{


System.out.println(counter);


counter +=
2;


}
While
(counter
100);




May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here