星期三, 1月 04, 2006

lab-0102

import java.io.*;
public class lab_0102 {
public static void main(String args[]) throws IOException {
double[] num = new double[5];
int a, b;
double temp;
System.out.println("Enter some number:");
for (a = 0; a <>
BufferedReader input = new BufferedReader(new InputStreamReader(
System.in));
num[a] = Integer.parseInt(input.readLine());
}
for (a = 0; a <>
for (b = 0; b <>
if (num[a] > num[b]) {
temp = num[a];
num[a] = num[b];
num[b] = temp;
}
}
}
for (a = 0; a <>
System.out.print("" + num[a] + " ");
}
System.out.println("");
System.out.println("Largest to Smallest.");
System.exit(0);
}
}

0 Comments:

張貼留言

<< Home