The program finds the addition of two matrices.

Program Code:
class Add
{
public static void main(String args[])
{
int [][] x={{1,2,3}, {4,5,6}, {7,8,9}};
int [][] y={ {11,12,13}, {14,15,16}, {17,18,19} };
int [][] z=new int[3][3];
for(int i=0; i<3; i++)
for(int j=0; j<3; j++)
{
z[i][j]=x[i][j]+y[i][j];
}
for(int i=0; i<3; i++)
{
for(int j=0; j<3; j++)
{
System.out.print(z[i][j]+” ”);
}
System.out.print(“\n”);
}
}
}
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: