Array Sums in Java


class RowSum
{
int A[][]={{1,0,0,1},{1,-2,0,1},{-1,2,2,1}};
int B[][]={{1,1,-1,1},{0,1,-1,1},{0,0,1,1}};
int C[][]=new int[3][4];
void printArray()
{
for(int i=0;i<3 data-blogger-escaped-br="" data-blogger-escaped-i=""> {
for(int j=0;j<4 data-blogger-escaped-br="" data-blogger-escaped-j=""> System.out.print(C[i][j]+" ");
System.out.println();
}
}
void Addition()
{
for(int i=0;i<3 data-blogger-escaped-br="" data-blogger-escaped-i=""> {
for(int j=0;j<4 data-blogger-escaped-br="" data-blogger-escaped-j=""> C[i][j]=A[i][j]+B[i][j];
}
}
public static void main(String args[])
{
RowSum m=new RowSum();
m.Addition();
System.out.println("\n Array elements after addition:");
m.printArray();
}
}

Comments

Popular posts from this blog

GL_QUAD_STRIP Example In OpenGl

GL_POLYGON Example In OpenGl