Monday, 27 August 2018

Contoh script java Matrik input data menggunakan DataInputStream


import java.io.*;

class satu
{
                public static void main (String[]args) throws IOException
                {
                DataInputStream x = new DataInputStream (System.in);
                {
                               
                                int matriks [][]=new int [3][3];
                                System.out.print("Batas ordo baris = ");
                                int baris=Integer.parseInt(x.readLine());
                               
                                System.out.print("Batas ordo kolom = ");
                                int kolom=Integer.parseInt(x.readLine());
               
                                System.out.println("Matriks A ");
                               
                                for (int y=1; y<=baris; y++)
                                {
                                               
                                                for (int z=1; z<=kolom; z++)
                                                {
                                                                System.out.print("A [" +y+ " , " +z+ "]");
                                                                matriks[y][z]=Integer.parseInt(x.readLine());
                                                }             
                                }
                }
}
}


Download selengkapnya disini







No comments:

Post a Comment