Introduction
Software Requirement
Simple program
- import java.io.*;
- class dsc {
- public static void main(String arg[]) {
- int i, j, t;
- int a[] = {
- 4,
- 2,
- 1,
- 5,
- 8
- };
- for (i = 0; i <= a.length; i++) {
- for (j = i + 1; j <= a.length - 1; j++) {
- if (a[i] < a[j]) {
- t = a[i];
- a[i] = a[j];
- a[j] = t;
- }
- }
- }
- for (i = 0; i < 10; i++) {
- System.out.println(+a[i] + "\n");
- }
- }
- }
Explanation
In this blog, I will explain about the descending order (numbers) program, using Java. The output will be displayed in the Run module.
Output


Join the conversation! Your thoughts help the community grow.