Senin, 23 Februari 2015

Membuat Matrik dengan Java

package javaapplication2;
import java.io.DataInputStream;
import java.io.IOException;

public class matrik {
    public static void main(String [] args) throws IOException{
        DataInputStream input=new DataInputStream(System.in);
        int m[][]=new int[100][100];
        int m2[][]=new int[100][100];
        int jumlah[][]=new int[100][100];
        int i,j,n;
       
        System.out.print("Masukkan Nilai Ordo = ");
        n= Integer.parseInt(input.readLine());
        System.out.println("Input Data Matrik 1");
        for (i=1;i<=n;i++){
            for (j=1;j<=n;j++){       
                System.out.print("Nilai - " +i+","+j+ " = ");
                m[i][j]= Integer.parseInt(input.readLine());
            }
        }