# Java programming

can anybody help me..

Multidimensional Array
Use a two-dimensional array (for example of 3 by 3) to simulate the addition operation of two matrices.
Sample output:

the first matrix:
1 2 3
1 0 1
1 2 1

the second matrix:
1 1 1
2 2 2
3 3 3

The total of two matrices:
2 3 4
3 2 3
5 4 5

i have make this.. but i don't know how to add the addition part..

this is my coding..
public class LabExecriseC
{
public static void main(String args[])
{
String output="";
int total;
int array1[][]={{1,2,3},{1,0,1},{2,1,2}};
int array2[][]={{1,1,1},{2,2,2},{3,3,3}};

output=output+"The First Matrix:\n";

for(int row = 0; row<array1.length; row++)
{

for (int column=0; column<array1[row].length; column++)
output = output+array1[row][column]+" ";

output = output+ "\n";
}

output = output+ "\nThe Second Matrix:\n";

for (int row = 0; row<array2.length; row++)
{

for (int column=0; column<array2[row].length; column++)
output = output+array2[row][column]+" ";

output = output+ "\n";
}

output=output+"Sum of two Matrix:\n";

System.out.println(output);

}

}

*or you have the other ways to settel this problem

1. 👍 0
2. 👎 0
3. 👁 95
1. I do not think your sum of matrix A and matrix B is correct
I get
the first matrix:
1 2 3
1 0 1
1 2 1

the second matrix:
1 1 1
2 2 2
3 3 3

The total of two matrices:
2 3 4
3 2 3
4 5 4

in flow chart form:
do 1 from n = 1 to 3
do 1 from m = 1 to 3

1 output (n,m) = inputA(n,m) + inputB(n,m)

do 3 for n = 1 to 3
3 print or store output(n,m) for m = 1 to 3

end

1. 👍 0
2. 👎 0
posted by Damon

## Similar Questions

1. ### Math

Tony broke a larger array into 2 x 9 array and a 4 x 9 array. What did the larger array look like? Draw picture. Write a number sentence to show the relationship between the large array and the two smaller arrays.

asked by Cc on November 29, 2016
2. ### math

don break a 4x7 array into a 2x7 array and another array. what is the fact for dons second array? write a number sentence that models the relationship of the 4x7 array to the other two arrays.

asked by stacey on January 8, 2013
3. ### college

Write a C++ program to fill an array with 6 numbers, and then reverse the values of this array. Note: By using a function with two parameters with the name of the array and the size of this array.

asked by ola on December 22, 2010
4. ### Math

Don breaks a4 by 7array into a 2 by 7 array and another array. What is the fact for dons second array? Write a.number sentence that models the relationship of the 4 by 7 array to the other two arrays

asked by Kolby knapp on January 2, 2013
5. ### programming

A. Write a program which reads an array of up to 200 integers from input and then does all the following in order 1. searches the array for a specific integer given by the user and outputs its position in the array; 2. outputs the

asked by pauline on April 3, 2015
6. ### math

with each array write the factor pair. Rember that the # of row in the array are one factor and that the # of columns in the array is the other factor. Continue to build every possible array until you have all the possible factors

asked by Elizabeth on August 29, 2012
7. ### programming

I really need help in this it makes me confuse.I should make a program to find a pattern...so can somebody help me... Write a function to recognize an pattern within another array. Your function should have the following

asked by Ryan on October 24, 2009
8. ### Computer Science

What are two dimensional arrays and can they be seen anytime as a one dimensional array?

asked by Ren on March 16, 2010
9. ### Programming Logic & Design

Modify the previous process to store the scores in an array. You will need to use either parallel arrays or a two-dimensional array in order to store the score, slope and rating for each entry. In the loop you created in the

asked by Julie on April 10, 2014
10. ### Java programming

how do i add prime numbers in this java code: public class PrimeNumbers { public static void main(String[] args) { int[] array = new int; Scanner in = new Scanner(System.in); System.out.println("Enter the elements of the

asked by anonymous on April 7, 2019
11. ### math

Suppose 100 dots are arranged in a square 10 × 10 array, and each dot is colored red or blue. (a) Prove that this array must contain a “monochromatic” rectangle. That is, no matter how the red and blue colors are assigned,

asked by Tyler on April 15, 2010

More Similar Questions