Computer Science, asked by luckyvaibhav9, 1 year ago

programs of bubble sorting with buffered reader

Answers

Answered by viny
1
To long.. but worth :-
public class q
public static void main(String args[])throws IOException
{
InputStreamReader read=new InputStreamReader(System.in);
BufferedReader abc=new BuffereReader(read);
int a[]=new int[10]// Any no of element you want
for(int i=0;i<a.length-1;i++)
{
for(int j=0;j<(a.length-1)-i;j++)
if(a[j]<a[j+1])//for descending order, > for ascending order
{
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
}
}
for(i=0;i<a.lenght-1;i++)
{
System.out.println(a[i]);
}
}
Similar questions