import java.util.*;
class largest
{
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
int a,b;
System.out.println("Enter the two numbers");
a=sc.nextInt();
b=sc.nextInt();
if(a>b)
System.out.println("The largest number is"+a);
else
System.out.println("The largest number is"+b);
}
}
Output:
Enter the two numbers
14
15
The largest number is 15
import java.util.*;
class smallest
{
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
int a,b;
System.out.println("Enter the two numbers");
a=sc.nextInt();
b=sc.nextInt();
if(a<b)
System.out.println("The smallest number is"+a);
else
System.out.println("The smallest number is"+b);
}
}
Output:
Enter the two numbers
14
15
The smallest number is 14
class largest
{
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
int a,b;
System.out.println("Enter the two numbers");
a=sc.nextInt();
b=sc.nextInt();
if(a>b)
System.out.println("The largest number is"+a);
else
System.out.println("The largest number is"+b);
}
}
Output:
Enter the two numbers
14
15
The largest number is 15
import java.util.*;
class smallest
{
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
int a,b;
System.out.println("Enter the two numbers");
a=sc.nextInt();
b=sc.nextInt();
if(a<b)
System.out.println("The smallest number is"+a);
else
System.out.println("The smallest number is"+b);
}
}
Output:
Enter the two numbers
14
15
The smallest number is 14