-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSort_Desend.java
More file actions
26 lines (25 loc) · 768 Bytes
/
Sort_Desend.java
File metadata and controls
26 lines (25 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.util.Scanner;
public class Sort_Desend {
public static void main(String[] args) {
//
Scanner sc = new Scanner(System.in);
System.out.print("Enter Data Limit = ");
int v = sc.nextInt();
int [] desending = new int[v];
for (int i = 0; i < v; i++){
desending[i] = sc.nextInt();
}
for (int i = 0; i < v; i++){
for (int j = i+1; j < v; j++){
if (desending[i] < desending[j]){
int a = desending[i];
desending[i] = desending[j];
desending[j] = a;
}
}
}
for (int i = 0; i < v; i++){
System.out.print(desending[i] +" ");
}
}
}