Static
Solution :-
class max3
{
public static void main(String args[])
{
int no1=10,no2=20,no3=30;
if((no1 > no2) && (no2 > no3))
{
System.out.println("First number is Big :- "+no1);
}
else if(no2 >no3)
{
System.out.println("Second number is Big :- "+no2);
}
else
{
System.out.println("Third number is Big :- "+no3);
}
}
}
Output :-
Dynamic
Solution :-
import java.util.*;
class max3d
{
public static void main(String args[])
{
int no1,no2,no3;
Scanner out = new Scanner(System.in);
System.out.println("Enter the first number :- ");
no1 = out.nextInt();
System.out.println("Enter the Second number :- ");
no2 = out.nextInt();
System.out.println("Enter the third number :- ");
no3 = out.nextInt();
if((no1 > no2 ) && (no1 > no3 ))
{
System.out.println("First number is Big :- "+no1);
}
else if(no2 >no3)
{
System.out.println("Second number is Big :- "+no2);
}
else
{
System.out.println("Third number is Big :- "+no3);
}
}
}
Output :-