import javax.swing.JOptionPane;
public class Contoh1 {
public static void main(String[] args) {
int baris = 0;
int kolom = 0;
baris = Integer.parseInt
(JOptionPane.showInputDialog(“baris:”)
);
kolom = Integer.parseInt
(JOptionPane.showInputDialog
(“ kolom:”));
int[][] matriksA = new int[baris][kolom];
int[][] matriksB = new int[baris][kolom];
int[][] matriksC = new int[baris][kolom];
for(int x=0; x
;
matriksB[x][y] = (int)(Math.random()*100)
;
matriksC[x][y] = matriksA[x][y] + matriksB
[x][y];
}
}
System.out.println(“matriks A”);
System.out.println(“———”);
for(int x=0; x
}
System.out.println();
}
System.out.println();
System.out.println (“matriks B”);
System.out.println(“———”);
for(int x=0; x
}
System.out.println(“”);
}
System.out.println();
System.out.println (“matriks A + B”);
System.out.println(“————-”);
for(int x=0; x
}
System.out.println();
}
}
}
Langganan:
Posting Komentar (Atom)
0 komentar: