Uses a while loop to count down every odd number from 40 to


Loop Assignment:

Uses a while loop to count down every odd number from 40 to 0, printing each off number down to zero, except the number 3 and

33 Program must use a continue and an if statement.

This is what I have so far but I am unable to get the continue statement to work with the program. Please help...Thanks.

public class counter
{

public static void main(String args[])
{
int counter = 40;

while(counter >= 0)
{
if (counter % 2 == 1)
System.out.println(counter + " ");
counter--;
}}}

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Uses a while loop to count down every odd number from 40 to
Reference No:- TGS01251612

Now Priced at $20 (50% Discount)

Recommended (90%)

Rated (4.3/5)