programs of bubble sorting with buffered reader
Answers
Answered by
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]);
}
}
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
English,
7 months ago
India Languages,
7 months ago
Science,
7 months ago
History,
1 year ago
Chemistry,
1 year ago