Im stuck on how to display 5 integers in ascending order.i only have the idea to input 3 integers.what is my lacking to my code.Can you figure it out.thank you so much.hope you gonna help me
import java.util.*;
public class ascendingorder
{
static Scanner console = new Scanner(System.in);
public static void main(String[]args)
{
int x,y,z;
System.out.print("Enter the first number: " );
x = console.nextInt();
System.out.println();
System.out.print("Enter the second number: " );
y = console.nextInt();
System.out.println();
System.out.print("Enter the third number: " );
z = console.nextInt();
System.out.println();
if ((x<y) && (x<z))
{
System.out.print("Numbers in ascending order are: " +x );
if (y<z)
System.out.println(" "+ y + " " + z );
else
System.out.println(" " + z + " "+ y );
}
else
if ((y<x) && (y<z))
{
System.out.print("Numbers in ascending order are: " +y );
if (x<z)
System.out.println(" "+ x + " " + z );
else
System.out.println(" " + z + " "+ x );
}
else
if ((z<x) && (z<y))
{
System.out.print("Numbers in ascending order are: " +z );
if (x<y)
System.out.println(" "+ x + " " + y );
else
System.out.println(" " + y + " "+ x );
}
}
}