Hey guys, I'm trying to make this program that allows a person to set the size of an array to any value they choose. Then, the program will ask the user to input n values to be stored in the array at the corresponding index. Then the program modifies each array element by multiplying it with by its index. And at the end, prints the finals contents of the array. This is what I have so far:
package dastrap;
import java.util.Scanner;
public class DASTRAP {
public static void main(String[] args) {
Scanner s = new Scanner (System.in);
System.out.print(" Enter the size of the array: ");
int sizeOfArray = s.nextInt();
for(int index = 0; index < sizeOfArray; index++){
System.out.print(" Input value: ");
}
}
}
How do I store the inputs of the user into the array?