I'm trying to create a program which takes values that are doubles from the user and stores them in arrays before dividing them and rounding the answers. However I keep receiving errors trying to create double arrays.
double n = sc.nextDouble();
double a[] = new double[n];
double b[] = new double[n];
double roundedValues[] = new double[n];
for (double i = 0; i < a.length; i++) {
System.out.println("Please enter the values you would like to divide as pairs of two numbers: ");
// Read pair and store it inside i-th position of a and b arrays
System.out.println("Enter first number: ");
a[i] = sc.nextDouble();
System.out.println("Enter second number you would like to divide by: ");
b[i] = sc.nextDouble();
roundedValues[i] = Math.round(a[i] / b[i]);
}
The error I'm getting where I've declared the arrays says:
incompatible types: possible lossy conversion from double to int