programme:- sum of matrices using two dimensional array.
public class array3
{
public static void main(String args[])
{
int x[][]={{4,5},{4,3}};
int y[][]={{5,3},{4,3}};
int i,j;
int z[][]=new int[2][2];
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
z[i][j]=x[i][j]+y[i][j];
System.out.print(z[i][j]);
}
System.out.println();
}
}
}
public class array3
{
public static void main(String args[])
{
int x[][]={{4,5},{4,3}};
int y[][]={{5,3},{4,3}};
int i,j;
int z[][]=new int[2][2];
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
z[i][j]=x[i][j]+y[i][j];
System.out.print(z[i][j]);
}
System.out.println();
}
}
}
No comments:
Post a Comment