Question: Homework 1-1 Textbook Section 5.15 Write a Java program that uses an int variable num which starts at 1. Your program will have a loop
Homework 1-1 Textbook Section 5.15 Write a Java program that uses an int variable num which starts at 1. Your program will have a loop that will continue as long as num is less than or equal to 50. The loop will do the following for each iteration of the loop, and print out all appropriate sentences for that number. 1. If num is odd, you should output: num is an odd number 2. If num is even you should output: aum is an even number 3. If num is divisible by 2, you should output: num is divisible by 2 4. If num is divisible by 5, you should output: num is divisible by 5 5. If num is divisible by 8, you should output: num is divisible by 8 6. If num is divisible by 11, you should output: num is divisible by 11 7. Increment num Please note that your class should be named FirstLoop
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
