Question: Write Java program that uses anintvariablenumwhich starts at1. Your program will have a loop that will continue as long asnumis less than or equal to30.

Write Java program that uses anintvariablenumwhich starts at1.

Your program will have a loop that will continue as long asnumis less than or equal to30. The loop will do the following

  1. Ifnumis odd, you should output:numis an odd number
  2. Ifnumis even, you should output:numis an even number
  3. Ifnumis divisible by 3, you should output:numis divisible by 3
  4. Ifnumis divisible by 5, you should output:numis divisible by 5
  5. Ifnumis divisible by 7, you should output:numis divisible by 7
  6. Ifnumis divisible by 9, you should output:numis divisible by 9
  7. Incrementnum

Please note that your class should be namedFirstLoop.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!