"num" is zero,
-
Create a Java
program that declares and initializes an integer variable "num" with a value of your choice. -
Use the "if-then" statement to check if "num" is even or odd. If "num" is even, output a message to the console indicating that it is even. If "num" is odd, output a message to the console indicating that it is odd.
-
Use the "if-then-else" statement to check if "num" is positive or negative. If "num" is positive, output a message to the console indicating that it is positive. If "num" is negative, output a message to the console indicating that it is negative. If "num" is zero, output a message to the console indicating that it is zero.
-
Use a nested "if-then-else" statement to check if "num" is divisible by 2 and 3. If "num" is divisible by 2 and 3, output a message to the console indicating that it is divisible by both. If "num" is only divisible by 2, output a message to the console indicating that it is only divisible by 2. If "num" is only divisible by 3, output a message to the console indicating that it is only divisible by 3. If "num" is not divisible by 2 or 3, output a message to the console indicating that it is not divisible by either.
Step by step
Solved in 2 steps with 1 images