* array_1.java
To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package matriks;
/**
*
* @author andika
*/
public class matriks {
/** Creates a new instance of array_1 */
public static void main(String[] args) {
int A[][] = new int[3][4];
int total[]=new int[3];
int i,j;
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 4; y++) {
A[x][y]=5;
}
}
//hitung total setiap salesman
i=0;
while (i<=2)
{
total[i]=0;
j=0;
while (j<=3)
{
total[i]=total[i]+A[i][j];
j=j+1;
}
i=i+1;
}
// output
i=0;
while (i<=2)
{
System.out.println("total ["+i+"] = "+total[i]);
i=i+1;
}
}
}