星期一, 12月 26, 2005

Sorting

import java.io.*;

public class Sorting {
public static void main(String[] args) throws IOException {
BufferedReader keyboard = new BufferedReader(new InputStreamReader(
System.in));
double[] a = new double[5];
double temp;
int i, j;
System.out.println("Enter 5 number:");
for (i = 0; i <>
a[i] = Double.parseDouble(keyboard.readLine());
}
for (i = 0; i <>
for (j = 0; j <>
if (a[i] <>
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.println("The answer:");
for (i = 0; i <>
System.out.println(a[i]);
}
}
}

0 Comments:

張貼留言

<< Home