Skip to main content

Posts

Showing posts with the label 3. Write a Java program to check whether a number is negative

ads1

3. Write a Java program to check whether a number is negative, positive or zero.

  3. Write a Java program to check whether a number is negative, positive or zero. Solution :-  Static class posnegzero {     public static void main(String args[])     {     int no1=-0;         if(no1 >0)         {             System.out.println("The number is Positive:- "+no1);         }         else if(no1 < 0)         {             System.out.println("The number is Negative :- "+no1);         }     else     {         System.out.println("The number is Zero :- "+no1);     }     } }  Output :-  Dynamic Solu...

ads2