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

ReneRene
Change my mind. I dare you.
Chat with Rene
MaxineMaxine
I respect you enough to keep it real.
Chat with Maxine
SteveSteve
Knowledge is a journey, you know? We'll get there.
Chat with Steve

Add your answer:

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