1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sasho [114]
3 years ago
15

Write a method named matrixAdd that accepts a pair of two-dimensional arrays of integers as parameters, treats the arrays as 2D

matrices and adds them, returning the result. The sum of two matrices A and B is a matrix C where for every row i and column j, Cij = Aij + Bij. You may assume that the arrays passed as parameters have the same dimensions.
Computers and Technology
1 answer:
Stella [2.4K]3 years ago
7 0

Answer:

The code to this question can be given as follows:

Code:

int matrixAdd(int[][] a, int[][] b) //defining method matrixAdd

{

int c[x][y]=0;//defining variable  

   for(int x = 0; x<a.length; x++)  //loop for add rows

   {

       for(int y= 0; y<a[i].length; y++) //loop for add column

       {

           int c[x][y] = a[x][y] + b[x][y]; //add array elements

       }

   }

  return c[x][y];//return value

}

Explanation:

In the above method definition code, a method "matrixAdd" is defined that contains two integer 2D arrays "a[][] and b[][]" in its parameter, and this function returns the sum of both array.

  • Inside this method, another integer 2D array "c[][]" is defined that contains nothing.
  • To add all array elements the for loop is defined, which uses the array variable "c[][]" to add all array elements and return its value.

You might be interested in
How does light move? Shift? Bounce between different objects?
ZanzabumX [31]

Answer:

Bounce between different objects

Explanation:

Light probably will bounce off of objects or it might go through, i think it depends on what object and what material.

6 0
4 years ago
Variablesallow us to manipulate data through the ___________.
gladu [14]

Answer:

Reference

Explanation:

Variables provide reference to the stored data value.

For example:

int i = 0;

Here i is a variable of type int with an initial value of 0. i is a reference to this stored value 0. Now if I want to update the data, I can do so using this reference.

i = 1;

Now the reference is used to manipulate the stored data and change it to 1. In a similar manner all updates to the value can be done using the variable reference.

8 0
3 years ago
7.3 Code Practice edhesive
sladkih [1.3K]

Answer:

def print_sum(a,b,c):

 print(a+b+c)

one = int(input("Enter the 1st number: "))

two = int(input("Enter the 2nd number: "))

three = int(input("Enter the 3rd number: "))

print_sum(one,two,three)

Explanation:

hope this helped :)

5 0
3 years ago
Read 2 more answers
DMA controllers ____.A) do not utilize an additional, special purpose, processorB) are a nonstandard component in PCs of todayC)
otez555 [7]

Answer:

D) can access main memory at the same time as the main CPU

Explanation:

DMA is short for Direct Memory Access, these controllers allow the device to transfer data directly to and from the memory modules without interfering with CPU processes. Therefore it can access main memory at the same time as the main CPU. Thus freeing up CPU processing power for other tasks while also retrieving the data necessary.

8 0
3 years ago
A Web site that allows users to enter text, such as a comment or a name, and then stores it and later display it to other users,
balandron [24]

Answer:

Option(c) is the correct answer.

Explanation:

Cross-site scripting is the type of security breach that are usually found in the  software applications.The main objective of cross site scripting it is used by the hackers to exploit the data security.

  • The cross site scripting is the collection of web pages  that enables people to insert the text like comment,  name stores it afterwards it save the data and then  it appears to the other users.
  • Others options are incorrect because they are not related to given scenario.
5 0
3 years ago
Read 2 more answers
Other questions:
  • toThePowerOf is a method that accepts two int arguments and returns the value of the first parameter raised to the power of the
    6·1 answer
  • 52.
    11·1 answer
  • Only Lysita knows the password for the question......
    10·1 answer
  • What are all the folders located on the DOCK called?
    11·1 answer
  • Effective presentations vary the color scheme on each slide.
    7·2 answers
  • Ok so I usually don’t do this but I just need an answer , on Instagram a notification popped up while I was watching someone’s s
    9·2 answers
  • What are some of the ways we can resolve IPv4 address shortages? Check all that apply.
    13·1 answer
  • It is usually simple to delete old posts and online conversations if they make you look bad.
    5·1 answer
  • The process of arranging the item of a column in some sequence or order is known as?
    12·1 answer
  • Send link for a qc or paddle
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!