import java.util.*;
class bubblesort
{
public static void main()
{
Scanner s=new Scanner(System.in);
int arr[]=new int[10];
int i,j,temp;
System.out.println("Enter 10 nos.");
for (i=0;i< 10;i++)
{
arr[i]=s.nextInt();
}
System.out.println("Before Sorting");
for(i=0;i< 10;i++)
{
System.out.print(arr[i]+",");
}
System.out.println();
//BUBBLE SORT PART
for(i=0;i< 9;i++)
{
for(j=0;j< 9-i;j++)
{
if (arr[j]< arr[j+1]) //for ascending just change < to >. NOTHING ELSE
{ // descending--- < ascending--- >
temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}
System.out.println("After Sorting");
for(i=0;i< 10;i++)
{
System.out.print(arr[i]+",");
}
}
}