Write a Java program to check and display whether the given number is positive even, positive odd, negative even or negative odd or zero.
i) using if…else if … ladder ii) nested if
Answers
Answered by
0
Explanation:
In this post, we will write two java programs, first java programs checks whether the specified number is positive or negative. The second program takes the input number (entered by user) and checks whether it is positive or negative and displays the result.
→ If a number is greater than zero then it is a positive number
→ If a number is less than zero then it is a negative number
→ If a number is equal to zero then it is neither negative nor positive.
Lets write this logic in a Java Program.
Similar questions