public class BSort
{
public static void main()
{
int a[]={12,45,34,23,1,3,2,7,98};
for(int x=0; x<a.length-1; x++)
{
for(int y=x+1; y<a.length; y++)
{
if(a[x] > a[y])
{
int temp=a[y];
a[y]=a[x];
a[x]=temp;
}
}
}
for(int x=0; x<a.length; x++)
{
System.out.println(a[x]);
}
}
}
{
public static void main()
{
int a[]={12,45,34,23,1,3,2,7,98};
for(int x=0; x<a.length-1; x++)
{
for(int y=x+1; y<a.length; y++)
{
if(a[x] > a[y])
{
int temp=a[y];
a[y]=a[x];
a[x]=temp;
}
}
}
for(int x=0; x<a.length; x++)
{
System.out.println(a[x]);
}
}
}
No comments:
Post a Comment
Please write your comment in the box below...