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

Popular posts from this blog

Completed Certification from J.P. Morgan - Software Engineering Job Simulation

Wap to use Ternary Operator in Java

Wap to Use Increment And Decrement Operator In Java