Monday, November 18, 2013

Multiplication Table (times table); "Java Code"

 multiplication table a.k.a "times table" using Java as requested by you "my friend".
In mathematics, a multiplication table (sometimes, less formally, times table) is a mathematical table used to define a multiplication operation for an algebraic system. http://en.wikipedia.org/wiki/Multiplication_table 

---------
Source  Code
---------
// static import
import static java.lang.System.out;

// class name
class MultiplicationTable
{
// variable declaration
 int i, j;

//constructor
MultiplicationTable()
{
// for loop
   for (i = 1; i <=12; i++)
   {
      for (j = 1; j <=12; j++)
      {

      out.printf("%d\t", i*j);

      if (j == 12)
       out.println();
      }
   }
}
      // main method
public static void main(String [] args)
{
     // constructor call
new MultiplicationTable();
}
 }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Simply copy the above code and paste in any IDE (integrated development environment) of your choice, then compile and run. You can set d upper bound limit which is 12 in this code, "see line 14 and 16", to any limit of your choice by editing the limit set in the code (from the for loop). 
Below is what your output should look like after running;