WAP to use Logical Operator Java
import java.util.Scanner;
class Logical1
{
public static void main(String[] arg)
{
Scanner scanner=new Scanner(System.in);
int n1,n2,n3;
System.out.print("Enter First Number:");
n1=scanner.nextInt();
System.out.print("Enter second Number:");
n2=scanner.nextInt();
System.out.print("Enter Third Number:");
n3=scanner.nextInt();
if(n1>n2 && n2>n3)
{
System.out.println("The && Logical operators Statement is true:");
System.out.println("First Number is Greater than two numbers:"+ n1);
}
if(n1>n2 || n2>n3)
{
System.out.println("The || Logical operators Statement is also true:");
}
if(n1==n2)
{
System.out.println("The == Logical operators Statement is also true:");
}
if(n1!=n2)
{
System.out.println("The ! Logical operators Statement is also true:");
}
}
}
Comments
Post a Comment