Share
Explore BrainMass

Java Programming

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--;
}

}
}

$2.19