Showing posts with label Addition table with help of TWO DIMENSIONAL ARRAY. Show all posts
Showing posts with label Addition table with help of TWO DIMENSIONAL ARRAY. Show all posts

Sunday, November 18, 2012

Addition table with help of TWO DIMENSIONAL ARRAY !!!

Here is the program of addition table with help of two dimensional array and you can also create multiplication or subtraction table !  

____________________________________


public class Table {

public static void main(String[] args) {
// TODO Auto-generated method stub

int row = 17, column = 17;

int product[][]= new int [row] [column];

System.out.println("  ");

for(int i = 1; i<row;i++){
for(int j = 0; j< column; j++){

product[i][j] = i +j;

System.out.print(" "+product[i][j]);
}
System.out.println(" ");
}
}
}
_______________________________________

Output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 
 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 
 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 
 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 
 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 
 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 
 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 
 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 
 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 
 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 
 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 
 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 
 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 
 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 
 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 
_______________________________________________________