Write java program to print Biggest of 3 Numbers using Logical Operators.
Write java program to print Biggest of 3 Numbers using Logical Operators.
Program :
import java.util.*;
public class Largest
{
public static void main(String args[])
{
int n1, n2, n3, big;
Scanner scan= new Scanner(System.in);
System.out.print("Please, Enter Any 3 integer numbers: ");
n1=scan.nextInt();
n2=scan.nextInt();
n3=scan.nextInt();
if(n1>n2 && n1>n3)
big=n1;
else if(n2>n1 && n2>n3)
big=n2;
else
big=n3;
System.out.println("Biggest No: " + big);
}
}
Output:
Please,Enter Any 3 integer numbers:
10
40
50
Biggest No:50
Comments
Post a Comment