.: Java :. Penjumlahan dengan array

package Array;

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author Nurul C.
*/
public class bil_array {
public static void main(String[] args) {
// TODO code application logic here
int[] data1={2,4,6,8};
int[] data2={2,4,6,8};
int jum,i,j,x=0;
System.out.println(” +   2   4   6   8″);
System.out.println(” ———————“);
for(i=0; i<=3; i++){
x=x+2;
System.out.print(” “+x);
for(j=0; j<=3; j++){

jum=data1[i]+data2[j];
System.out.print(”   “+jum);
}
System.out.println(“”);
}
}
}

Berikut hasil outputnya :

array

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