/**
* @(#)dim2.java
* @author Widyawati
* @version 1.00 2013/11/7
*/
import java.util.*;
public class dim2 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int[][] matriksA= new int[10][10];
int[][] matriksB= new int[10][10];
int[][] matriksC= new int[10][10];
int k,b;
for(b=0;b<3;b++)
{
for(k=0;k<3;k++)
{
matriksA[b][k]= (int)(Math.random()*100);
matriksB[b][k]= (int)(Math.random()*100);
matriksC[b][k]= matriksA[b][k] + matriksB[b][k];
}
}
//Output Matriks A,B dan C
System.out.println("Matriks A");
for(b=0;b<3;b++)
{
for(k=0;k<3;k++)
{
System.out.print(matriksA[b][k]+ " ");
}
System.out.println("");
}
System.out.println("\nMatriks B");
for(b=0;b<3;b++)
{
for(k=0;k<3;k++)
{
System.out.print(matriksB[b][k]+ " ");
}
System.out.println("");
}
System.out.println("\nMatriks C(A+B)");
for(b=0;b<3;b++)
{
for(k=0;k<3;k++)
{
System.out.print(matriksC[b][k]+ " ");
}
System.out.println("");
}
}
}
Jumat, 15 November 2013
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar
Please Leave Your Comment :)