-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray_Descending.java
More file actions
37 lines (35 loc) · 956 Bytes
/
Array_Descending.java
File metadata and controls
37 lines (35 loc) · 956 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
27
28
29
30
31
32
33
34
35
36
37
import java.util.Scanner;
public class Array_Descending
{
public static void main(String[] args)
{
int[] no = new int[30];
int count;
int i, j, k;
Scanner scanner = new Scanner(System.in);
System.out.println("Enter how many number's you want to input:");
count=scanner.nextInt();
System.out.println("Enter The Number's");
for(int a=0;a<count;a++)
{
no[a]=scanner.nextInt();
}
for (i = 0; i < count; i++)
{
for (j = 0; j < count - i - 1; j++)
{
if (no[j] < no[j+1])
{
k = no[j];
no[j] = no[j+1];
no[j+1] = k;
}
}
}
System.out.println("The Array In Descending order is:");
for(int a=0;a<count;a++)
{
System.out.println(no[a]);
}
}
}