You are on page 1of 2

import javax.swing.

JOptionPane;
public class AscendingAndDescending
{
public static void main(String[] args)
{
int one =
Integer.parseInt(JOptionPane.showInputDialog(null,"Enter 3
integers "));
int two =
Integer.parseInt(JOptionPane.showInputDialog(null,"Enter 3
integers "));
int three =
Integer.parseInt(JOptionPane.showInputDialog(null,"Enter 3
integers "));

if(one > two && one > three)


{
System.out.println("Highest: "+ one);
if(two > three){
System.out.println("Second: "+ two);
System.out.println("Third: "+ three);
}else if(two < three){
System.out.println("Second: "+ three);
System.out.println("Third: "+ two);
}

}else if(two > one && two > three)


{
System.out.println("Highest: "+two);
if(three > one)
{
System.out.println("Second: "+ three);
System.out.println("Third: "+one);
}else if(three < one)
{
System.out.println("Second: "+ one);
System.out.println("Third: "+three);
}
}else if(three > one && three > two)
{
System.out.println("Highest: "+three);
if(two > one)
{
System.out.println("Second: "+two);
System.out.println("Third: "+ one);
}else if(two < one)
{
System.out.println("Second: "+one);
System.out.println("Third: "+ two);
}

You might also like