Question: Integer arrays origArray and offsetArray are read from input, each containing five elements. Update each element in origArray with origArray's element minus the corresponding element
Integer arrays origArray and offsetArray are read from input, each containing five elements. Update each element in origArray with origArray's element minus the corresponding element in offsetArray.
Ex: If the input is:
then the output is:
import java.util.Scanner;
public class ComputeOffset
public static void mainString args
Scanner scnr new ScannerSystemin;
final int NUMVALS ;
int origArray new intNUMVALS;
int offsetArray new intNUMVALS;
int i;
for i ; i NUMVALS; i
origArrayi scnrnextInt;
for i ; i NUMVALS; i
offsetArrayi scnrnextInt;
Your code goes here
for i ; i origArray.length; i
System.out.printorigArrayi;
System.out.println;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
