Hi, I am a beginner so bear with me. I have an assignment in which I have to create an array with numbers and then have a loop with condition to check in which order the user has inputed the numbers. Asc=1, desc=-1, other=0. This loop isn't working, i know it's wrong but can't figure out what to do, I have experienced with lots of options still nothing works for me.
import java.util.Scanner;
public class Arrange {
public static void main (String[] args){
Scanner input= new Scanner(System.in);
double numbers;
double [] arr=new double[5];
for (int i=0; i<5; i++){
System.out.println("Enter your numbers ");
numbers= input.nextDouble();
arr[i]=numbers;
}
for(int i=0; i<4; i++){
for (int j=1; j<5; j++){
if (arr[i]<arr[j]){
System.out.println ("1");
}else if (arr[i]>arr[j]){
System.out.println ("-1");
}else{
System.out.println("0");
}}
}
}
}
Thanks!