Can someone help me to continue this code using array?this is the sample output Enter number of element(2-10): 5 Element[1]: -3 Element[2]: 0 Element[3]: 10 Element[4]: 2 Element[5]: 7
Max Value is: 10
Min Value is: -3
Ascending order: -3 0 2 7 10
Descending order: 10 7 2 0 -3
I only have this code.
import java.util.Scanner;
public class Array1 {
public static void main(String[] args) {
Scanner n = new Scanner(System. in );
int num[] = new int[];
int ne = 0;
int e = 0;
System.out.print("Enter Number of Elements(2-10): ");
ne = n.nextInt();
for (int x = 1; x <= ne; x++) {
System.out.print("Element[" + x + "]: ");
e = n.nextInt();
}
}
}
The output of this is:
Enter number of element(2-10): 5
Element[1]: -3
Element[2]: 0
Element[3]: 10
Element[4]: 2
Element[5]: 7
Then I don't know how to get the others.