answersLogoWhite

0

Ascending order program for java

Updated: 8/11/2023
User Avatar

Wiki User

11y ago

Best Answer

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

11y ago
This answer is:
User Avatar

Add your answer:

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

What will be the program to arrange numbers stored in array in ascending order using pointers?

sorry


A C program using dynamic memory allocation to sort n names in ascending order?

Writing a C program that uses dynamic memory allocation to sort names in ascending order is a typical computer science assignment. To write this program, you must be in UNIX.


How to Sort values in ascending order in java?

// If your values are stored in an array... Arrays.sort(valuesArray); // If they're stored in a List... Collections.sort(valuesList);


How do you program a reverse auto loan calculator in JAVA?

In order to program a reverse auto loan calculator in JAVA, you are going to need a lot of experience with JAVA. There are online tutorials that can help you set up with fundamentals of JAVA so that you will be able to create almost any basic program you want.


What do you mean by multithread program in java?

A Program in Java that spawns multiple threads is called a multithreaded program in Java.


What version of java should you program in?

the version of java that you program in is not of much importance so to speak. But it is always advisable to use the latest version of java in order to use the full set of features that the latest version supports. The latest version of java is java 6 also called Tiger.


How do you write Ascending order program using 8086 microprocessor?

One many find this answer on YouTube. One also may find out how to write ascending order programs using an 8086 microprocessor by looking at the owners manual.


What is java virtucal mechine?

That refers to the program that runs the compiled Java program.


What is java program on computers?

#!/usr/bin/perl print 'java program';


Can data be stored in ascending order?

Data can be stored in ascending order, descending order or no particular order.


What are the multiples of 18 in ascending order?

The multiples of 18 in ascending order are 12345678


Data can only be stored in ascending order?

Data can be stored in ascending order, descending order or no particular order.