language: Java (sun-jdk-1.7.0_10)
date: 634 days 4 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.io.*;
 
public class Main
 
{
 
public static void main(String[] args) throws IOException
 
{
 
int i = 0;
int j = 0;
double temp = 0;
double[] intValue = new double[10];
String[] numbers = {"first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth"};
int len = intValue.length;
 
BufferedReader dataIn = new BufferedReader (new InputStreamReader(System.in));
 
for (i = 0; i < len; ++i)
 
System.out.println("Enter the " + numbers[i] + " number");
intValue[i] = Double.valueOf(dataIn.readLine());
 
{
 
for (j = 0; j < (len - 1) -i; j++)
if (intValue[j] > intValue[j+1]) 
 
{
 
temp = intValue[j];
intValue[j] = intValue[j+1];
intValue[j+1] = temp;
 
}
 
for (i = 0; i < 10; i++);
 
{
 
System.out.println("Array after sorting in ascending order");
System.out.println();
System.out.println(intValue[i]);
 
}
}
}
}