0

how to solve this easy problem?????


Write a Java program that would input ten numbers form the user and print the ten numbers sorted in descending order.

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by jon.kiparsky
0

Well, there are sorting methods, for example, see the API for Arrays. You could, for example, load the numbers into an array and let the sort() method do the work.

If you're supposed to write the sort yourself, you're probably looking for a bubbleSort: go through the list of numbers, and if any adjacent numbers are out of order, switch their order. Repeat until nothing changes.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.