Monday, December 26, 2005

Lab 12-19-2005 Sorting

import java.io.*;

public class Sorting {
public Sorting() {
}

public static void main(String[] args) throws IOException {
double[] score = new double[5];
int index, a, b;
double x;
BufferedReader keyboard = new BufferedReader(new InputStreamReader(
System.in));
System.out.println("Enter 5 numbers :");
for (index = 0; index < a =" 0;" b="a+1;b<5;b++){"> score[b]) {
x = score[a];
score[a] = score[b];
score[b] = x;
}
}
}
for (index = 0; index < 5; index++) {
System.out.println(score[index]);
}
}
}

0 Comments:

Post a Comment

<< Home