import java.io.*;
class array_bubble_sort
{
public static void bubble_sort() throws IOException
{
int y[]=new int[5];
int temp;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
for (int m=0;m<y.length;m++)
{
System.out.println("enter"+(m+1)+"value");
y[m]=Integer.parseInt(br.readLine());
}
for(int i=0;i<y.length;i++)
{
for(int k=0;k<y.length-1;k++)
{
if(y[k]<y[k+1])
{
temp=y[k];
y[k]=y[k+1];
y[k+1]=y[k];
}
}
}
for(int i=0;i<y.length;i++)
{
System.out.print(y[i]);
}
}
}
class array_bubble_sort
{
public static void bubble_sort() throws IOException
{
int y[]=new int[5];
int temp;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
for (int m=0;m<y.length;m++)
{
System.out.println("enter"+(m+1)+"value");
y[m]=Integer.parseInt(br.readLine());
}
for(int i=0;i<y.length;i++)
{
for(int k=0;k<y.length-1;k++)
{
if(y[k]<y[k+1])
{
temp=y[k];
y[k]=y[k+1];
y[k+1]=y[k];
}
}
}
for(int i=0;i<y.length;i++)
{
System.out.print(y[i]);
}
}
}
No comments:
Post a Comment