import javax.swing.*;
public class matriks3
{
public static void main (String [] args)
{
int ordo = 3;
int A[][] = new int [ordo][ordo];
int B[][] = new int [ordo][ordo];
int C[][] = new int [ordo][ordo];
for (int baris=0; baris<ordo; baris++)
{
for (int kolom=0; kolom<ordo; kolom++ )
{
A[baris][kolom] = Integer.parseInt(JOptionPane.showInputDialog("Masukkan Matriks A ["+(baris)+"]["+(kolom)+"]"));
B[baris][kolom] = Integer.parseInt(JOptionPane.showInputDialog("Masukkan Matriks B ["+(baris)+"]["+(kolom)+"]"));
C[baris][kolom] = Integer.parseInt(JOptionPane.showInputDialog("Masukkan Matriks C ["+(baris)+"]["+(kolom)+"]"));
}
}
System.out.println("\n"+"Matriks A");
for (int baris=0; baris<ordo ;baris++ )
{
for (int kolom=0;kolom<ordo ;kolom++ )
{
System.out.print ("| "+A[baris][kolom]+" ");
}
System.out.println ("| ");
}
System.out.println("\n"+"Matriks B");
for (int baris=0 ;baris<ordo ;baris++ )
{
for (int kolom=0; kolom<ordo; kolom++ )
{
System.out.print ("| "+B[baris][kolom]+" ");
}
System.out.println ("| ");
}
System.out.println("\n"+"Matriks C");
for (int baris=0 ;baris<ordo ;baris++ )
{
for (int kolom=0; kolom<ordo; kolom++ )
{
System.out.print ("| "+C[baris][kolom]+" ");
}
System.out.println ("| ");
}
}}
Tidak ada komentar:
Posting Komentar