Purchase Solution

Java Programming

Not what you're looking for?

Ask Custom Question

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

}
}

Purchase this Solution

Purchase this Solution


Free BrainMass Quizzes
Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Basic Networking Questions

This quiz consists of some basic networking questions.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.