Respuesta :
Answer:
The programming language is not stated; however, I'll answer this question using Java programming language.
Because of the length of the program, comments are used to explain some lines
See Attachment for program file
Program starts here
import java.util.*;
public class OperateArray{
public static void main(String [] args)
{
Scanner input = new Scanner(System.in);
//Declare Array
int arr[][] = new int[2][3];
//Fill array with 0
for(int row =0;row<2;row++)
{
for(int col=0;col<3;col++)
{
arr[row][col] = 0;
}
}
//Prompt user for input
for(int row =0;row<2;row++)
{
if(row == 0)
{
System.out.print("Enter top rows\n"); //Top rows
}
else
{
System.out.print("Enter bottom rows\n"); //Bottom Rows
}
for(int col=0;col<3;col++)
{
arr[row][col] = input.nextInt();
}
}
//Initialize difference to 0
int diff = 0;
//Print and Calculate Difference
for(int row =0;row<2;row++)
{
for(int col=0;col<3;col++)
{
if(row<1)
{
if(col<2)
{
System.out.print(arr[row][col]+" ");
}
else
{
System.out.print(arr[row][col]+" |Top Row of Array\n");
}
//Add top rows
diff+=arr[row][col];
}
else
{
if(col<2)
{
System.out.print(arr[row][col]+" ");
}
else
{
System.out.print(arr[row][col]+" |Bottom Row of Array\n");
}
//Subtract bottom rows from top
diff-=arr[row][col];
}
}
}
//Print Difference
System.out.print("Difference: "+diff);
}
}
//End of Program