Tugas Pemograman 2 Array (2/4/2010)


/**
* Write a description of class array2 here.
*
* @author (Hasan Mualim)
* @version (04072010)
*/
public class array2
{
public static void main(String[]args){
int bilangan[][]=new int[5][5];
int baris, kolom;
for (baris=0;baris<5;baris++)
for (kolom=0;kolom<5;kolom++)
bilangan[baris][kolom]=(baris)+(kolom);
for (baris=0;baris<5;baris++){
System.out.printf(“%d\t”,baris);
for (kolom=0;kolom<5;kolom++)
System.out.printf(“%d\t”,bilangan [baris][kolom]);
System.out.println(“\n”);
}
}
}

Hasil Outpunya :

hasilnya :

0 0 1 2 3 4

1 1 2 3 4 5

2 2 3 4 5 6

3 3 4 5 6 7

4 4 5 6 7 8

Tentang hasanmualim

Wong Ndeso
Pos ini dipublikasikan di Tak Berkategori. Tandai permalink.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s