This is a possible answer. Since loop and arrays cannot be used, much of the code is repetition. In the end a,b,c,d,e contain the values arranged from min to max. Hope this helps.
import java.io.*;
class SortFiveElements {
//utility function
//returns index as a:1, b:2, c:3, d:4, e:4
public static int find_min_index(int a,int b, int c,int d, int e, int min)
{
return a==min?1:(b==min?2:(c==min)?3:(d==min?4:5));
}
public static void main (String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(br.readLine());
int b = Integer.parseInt(br.readLine());
int c = Integer.parseInt(br.readLine());
int d = Integer.parseInt(br.readLine());
int e = Integer.parseInt(br.readLine());
//temp is a temporary var to store the i-th value which may get replaced
//smallest stores the min value among i-th to 5th element
//idx stores the minimum value's index
int temp,smallest,idx;
//i=1, i.e element 'a'
//temp has value of 1st element that is a
//find minimum among 5 elements in 'smallest', its index in 'idx'
//then swap
temp = a;
smallest = Math.min(a,Math.min(b,Math.min(c,Math.min(d,e))));
idx = find_min_index(a,b,c,d,e,smallest);
a = smallest;
if(idx==1)
a=temp;
else if(idx==2)
b = temp;
else if(idx==3)
c = temp;
else if(idx==4)
d = temp;
else
e = temp;
//i=2, i.e element 'b'
//temp has value of 2nd element that is b
//find minimum among 4 elements in 'smallest', its index in 'idx'
//NB: a already has the smallest value, so replace a with MAX_VALUE while finding index
//then swap
temp = b;
smallest = Math.min(b,Math.min(c,Math.min(d,e)));
idx = find_min_index(Integer.MAX_VALUE,b,c,d,e,smallest);
b = smallest;
if(idx==1)
a=temp;
else if(idx==2)
b = temp;
else if(idx==3)
c = temp;
else if(idx==4)
d = temp;
else
e = temp;
//repeat above process for 'c' and 'd'.
//'e' will automatically fall in place
temp = c;
smallest = Math.min(c,Math.min(d,e));
idx = find_min_index(Integer.MAX_VALUE,Integer.MAX_VALUE,c,d,e,smallest);
c = smallest;
if(idx==1)
a=temp;
else if(idx==2)
b = temp;
else if(idx==3)
c = temp;
else if(idx==4)
d = temp;
else
e = temp;
temp = d;
smallest = Math.min(d,e);
idx = find_min_index(Integer.MAX_VALUE,Integer.MAX_VALUE,
Integer.MAX_VALUE,d,e,smallest);
d = smallest;
if(idx==1)
a=temp;
else if(idx==2)
b = temp;
else if(idx==3)
c = temp;
else if(idx==4)
d = temp;
else
e = temp;
//we have the values in sorted order in a,b,c,d,e
System.out.println(a+" "+b+" "+c+" "+d+" "+e);
}
}