You are on page 1of 1

public class Main

{
public static void main(String[] args) {
System.out.println("matris par");
int m[][]= new int[3][3];
int f,c,p;
p=0;
for (f=0;f<=2;f++)
for (c=0;c<=2;c++)
{p=p+2;
m[f][c]=p;
}
for (f=0;f<=2;f++)
{
for (c=0;c<=2;c++)

{ System.out.print(m[f][c]+" ");}

System.out.println("");
}
}
}

-----------------------------------------------------------------------------------
----

public class Main


{
public static void main(String[] args)
{
System.out.println("Matriz par");
int m [][]= new int [3][3];
int f,c,p;
int acumulado;
acumulado=0;
p=0;
for (f=0;f<=2;f++)
for(c=0;c<=2;c++)
{
p=p+2;
m[f][c]=p;
}
//proceso impresión
for (f=0;f<=2;f++)
{
for(c=0;c<=2;c++)
{
System.out.print(m[f][c] + " ");
acumulado= acumulado + m[f][c];
}
System.out.println("");
}
System.out.println("-------------------------------------");
System.out.println("acumulado = " + acumulado);
}
}

You might also like