if-else conditions in java

 if-else conditions in java




PROGRAM:


import java.util.*;
class ifelse
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();//5
        if(a<0)
        {
            System.out.println("The number is negative");
        }
        else{
         
            System.out.println("The number is positive");
        }
    }
}





// -2
//The number is negative


//5
//The number is positive


Comments

Popular posts from this blog

PROGRAM TO FIND FACTORIAL OF A NUMBER USING RECURSION

PROGRAM TO FIND THE COUNT OF PARTICULAR NUMBER IN AN ARRAY

TELEPHONE BOOK USING HASHMAP