Monday, May 29, 2006

Lab 13


package s9226307;

public class s92263407 {

public static void main(String[] args){

int[] number={1,6,33,44,79,6,99,125,389};

int x,y,z;

for(x=0;x less than number.length;x++)

{

for(y=x+1;y less than number.length;y++)

{

if (number[x] greater than number[y])

{

z=number[x];

number[x]=number[y];

number[y]=z;

}

}

}

for(x=0;x less than number.length;x++)

{

System.out.println(""+number[x]);

}

}

}

0 Comments:

Post a Comment

<< Home