Question: pls write the code as simple as possible. Thank you. JAVA Task Read an integer from the stdin and save it to a variable, n.

pls write the code as simple as possible.

Thank you.

pls write the code as simple as possible. Thank you. JAVA Task

JAVA

Task Read an integer from the stdin and save it to a variable, n. Create an array, a, capable of holding n integers. Create a loop to read n integers corresponding to a_0, a_1, ..., a_n - 1 from stdin and save each integer a_i to a variable, val. This loop also needs to save each sequential value to its corresponding location in the array. For example, the first value must be stored in a_0, the second value must be stored in a_1, and so on. Print each element off the array alpha. Your code needs to loop through array a and print each sequential element on a new line. Input Format The first line contains a single integer, n, denoting the size of the array. Each line i of the subsequent n lines contains a single integer denoting the value of element a_i. Sample Input 5 10 20 30 40 50 Sample Output 10 20 30 40 50 Explanation When we save each integer to its corresponding index in alpha, we get alpha = [10, 20, 30, 40, 50]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!