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
- Ifnumis odd, you should output:numis an odd number
- Ifnumis even, you should output:numis an even number
- Ifnumis divisible by 3, you should output:numis divisible by 3
- Ifnumis divisible by 5, you should output:numis divisible by 5
- Ifnumis divisible by 7, you should output:numis divisible by 7
- Ifnumis divisible by 9, you should output:numis divisible by 9
- Incrementnum
Please note that your class should be namedFirstLoop.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
