The displayed numbers should be sorted in ascending order.
package com.codegym.task.task06.task0622;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/*
Ascending numbers
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
//write your code here
int[] list = new int[5];
for(int i=0; i<5; i++){
list[i] = Integer.parseInt(reader.readLine() );
}
for(int i=0; i<4; i++){
if(list[i+1] < list[i]){
list[i] = list[i] + list[i+1];
list[i+1] = list[i] - list[i+1];
list[i] = list[i] - list[i+1];
}
}
for(int i=0; i<5; i++){
System.out.println(list[i] );
}
}
}