Question: In JAVA!!! Declare a global variable N and initialize it to 5. In your main method: Declare and initialize an int array A with N
In JAVA!!!
Declare a global variable N and initialize it to 5.
In your main method:
Declare and initialize an int array A with N elements.
Print out As elements.
Call the reverse( ) method. Takes A as an argument.
Print out the elements of the resulting array.
Call the sum( ) method. Takes A and B as arguments.
Print out the elements of the resulting array.
In a separate method - reverse( ):
Declare an array B with N elements
Use a for loop to put the values of A into B in reverse order
Return array B to the main method
In a separate method - sum( ):
Declare an array C with N elements
Use a for loop to compute the sum of A and Bs elements (componentwise).
Put this sum into C (componentwise)
Return array C to the main method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
