2005/12/26

Lab 12-19-2005 Sorting

package work;
public class sort {
public static void main(String[] args) {
int num[] = {4, 3, 6, 7, 5};
int i,j, temp;
for (j = 0; j < i =" 1;"> num[i - 1]) {
temp = num[i - 1];
num[i - 1] = num[i];
num[i] = temp;
}
}
}
for(i=0;i<5;i++)
System.out.println(""+num[i]);
}
}

0 Comments:

張貼留言

<< Home