/* related posts with thumb nails */

program to sort array elements:

class SortTest

{

public static void main(String as[])

{

int a[]={10,22,87,9,97};

int i,j,temp;

int n=a.length;

for(i=0;i

for(j=i+1;j

if(a[i]>a[j])

{

temp=a[i];

a[i]=a[j];

a[j]=temp;

}

System.out.println("After Sorting:");

for(i=0;i

System.out.print(a[i]+"\t");

}

}

/* Output: */

After Sorting:

9 10 22 87 97

Related Topics:

1 comments:

Sameera said...

can any one explain the flow of above program

Post a Comment