#### Sum of 2-D Array Java Program

*Sum of matrix* using **2-D array java program**?

We all know about this word. Matrix is part of *Engineering **Mathematics*. We calculate sum of **matrix** in *Engineering Mathematics.* Now we can also solve that problem in 2-D array java program too.

**Using of this blog topic we can solve all matrix problems.**

int x[3][3] = {{10,20,30},{40,50,60},{70,80,90}};

int y[3][3] = {{ 1, 2, 3},{ 4, 5, 6},{ 7, 8, 9}}

**In this blog example, we have to find some sum.**

x[0][0] + y[2][2] = 10 + 9 => 19

x[0][1] + y[2][1] = 20 + 8 => 28

x[0][2] + y[2][0] = 30 + 7 => 37

………………

x[2][2] + y[0][0] = 90 + 1 => 91

So we can find cross sum of two values.

**Let’s see how to work in program.**

class arr8

{

public static void main(String args[])

{

int[][] x = new int[3][3];

int[][] y = new int[3][3];

x[0][0] = 10;

x[0][1] = 20;

x[0][2] = 30;

x[1][0] = 40;

x[1][1] = 50;

x[1][2] = 60;

x[2][0] = 70;

x[2][1] = 80;

x[2][2] = 90;

y[0][0] = 1;

y[0][1] = 2;

y[0][2] = 3;

y[1][0] = 4;

y[1][1] = 5;

y[1][2] = 6;

y[2][0] = 7;

y[2][1] = 8;

y[2][2] = 9;

for(int i=0;i<=2;i++)

{

for(int j=0;j<=2;j++)

{

System.out.print((x[i][j] + y[2-i][2-j]) + ” “);

}

System.out.println();

}

}

}

#### Output:

19 28 37

46 55 64

73 82 91

### Share and Enjoy

550total visits,1visits today

## 4 Comments

## special cash

I am sure this article has touched all the internet users, its really really fastidious post on building up new weblog.

## nike air zoom

I’m also commenting to make you be aware of what a outstanding encounter my cousin’s princess found browsing your web site. She realized lots of details, not to mention what it is like to possess an excellent helping mindset to get other folks effortlessly know certain complicated topics. You truly did more than my expected results. Thanks for producing such good, trustworthy, edifying and as well as easy tips about the topic to Ethel.

## adidas nmd

very nice put up, i certainly love this web site, carry on it

## yeezy boost 350

Nice post. I be taught something more difficult on different blogs everyday. It would all the time be stimulating to read content from different writers and observe a bit of one thing from their store. I抎 want to make use of some with the content material on my blog whether or not you don抰 mind. Natually I抣l give you a hyperlink on your web blog. Thanks for sharing.