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
Post a Comment