answersLogoWhite

0

public class BubbleSortAscendingOrderDemo

{

public static void main(String a[])

{

//Numbers which need to be sorted

int numbers[] = {23,5,23,1,7,12,3,34,0};

//Displaying the numbers before sorting

System.out.print("Before sorting, numbers are ");

for(int i = 0; i < numbers.length; i++)

{

System.out.print(numbers[i]+" ");

}

System.out.println();

//Sorting in ascending order using bubble sort

bubbleSortInAscendingOrder(numbers);

//Displaying the numbers after sorting

System.out.print("Before sorting, numbers are ");

for(int i = 0; i < numbers.length; i++)

{

System.out.print(numbers[i]+" ");

}

}

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

RossRoss
Every question is just a happy little opportunity.
Chat with Ross
EzraEzra
Faith is not about having all the answers, but learning to ask the right questions.
Chat with Ezra
RafaRafa
There's no fun in playing it safe. Why not try something a little unhinged?
Chat with Rafa

Add your answer:

Earn +20 pts
Q: Ascending order program for java
Write your answer...
Submit
Still have questions?
magnify glass
imp