htng

Rabu, 08 Juni 2011

public class Hitung {
    public static void main(String[] args){
        int[] data1={0,1,2,3,4,5};
        int[] data2={0,1,2,3,4,5};
        int i,j,jum;

        System.out.println("+ 0 1 2 3 4 5");
        System.out.println("-----------------");
            for (i=0;i<=5;i++){
                System.out.print(i);

            for(j=0;j<=5;j++){
                jum=data1[i]+data2[j];
                System.out.print(" "+jum);
            }
            System.out.println("");

    }

    }
}


Outputnya adalah
run:
+ 0 1 2 3 4 5
-----------------
0 0 1 2 3 4 5
1 1 2 3 4 5 6
2 2 3 4 5 6 7
3 3 4 5 6 7 8
4 4 5 6 7 8 9
5 5 6 7 8 9 10

0 komentar:

Posting Komentar