InterviewSolution
| 1. | 
                                    1. Write a program in Java to input a number (greater than zero) and if (a) it is an odd positive number then print its square and cube.(b) it is an even positive number then print sum of its squareandsquareroot pls give in blue j | 
                            
| 
                                   
Answer»  my dear friend the answer is Explanation:Java Program to check if Number is Positive or NegativeBY CHAITANYA SINGH | FILED UNDER: JAVA EXAMPLESIn 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.Example 1: Program to check whether the given number is positive or negativeIn this program we have specified the VALUE of number during DECLARATION and the program checks whether the specified number is positive or negative. To understand this program you should have the basic knowledge of if-else-if statement in CORE Java Programming.PUBLIC class Demo{ public static void main(String[] args) { int number=109; if(number > 0) { System.out.println(number+" is a positive number"); } else if(number < 0) { System.out.println(number+" is a negative number"); } else { System.out.println(number+" is neither positive nor negative"); } }}  | 
                            |