Question: Java question- Create an array named arr1 with 20 random numbers between 1 and 10(inclusively). Then produce a new array arr2 based on arr1 as
- Java question- Create an array named arr1 with 20 random numbers between 1 and 10(inclusively). Then produce a new array arr2 based on arr1 as follows: arr2 has the same length as arr1. In arr2, each element is the sum of the corresponding element in arr1 and the previous element of arr1, except the first number in arr2 equals the first number in arr1. For example,
If arr1 has the elements: 2 5 1 9 3 7 6
Then arr2 will be: 2 7 6 10 12 10 13
Please display the two arrays.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
