WAP in Java to input a number and deduce if the
entered number is positive or negative.
Answers
Answered by
46
Answer:
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.
Answered by
1
Answer:
- Read a number from the user using the Scanner class's method. check whether the given number is greater, lesser or, equal to 0. If it is greater given number is positive if the lesser given number is negative. the else given number is neither positive or negative.
Similar questions