Today we shall program another simple and basic problem.In our childhood many of us find difficulty in learning the **Multiplication tables**.Now, we shall take revenge on them by writing the program.Let us consider that our program takes two values as inputs which are,one for the number of tables required starting from 1 and other for limit of the multiplication…i.e either upto 10 or 20.Here we need two for loops,one for iteration of table and other for the multiplication of the table.Let us know write the code for it.

import java.util.*;
class tables
{
void calculation(int n,int limit)
{
for(int i=1;i<=n;i++)
{
System.out.println("***************Multiplication Table of " + i +" is ******************");
for(int j=1;j<=limit;j++)
{
System.out.println(i + " * " + j +" = "+(i*j));
}
}
}
}
class multiptables
{
public static void main(String arg[])
{
Scanner in = new Scanner(System.in);
System.out.println("Enter number of tables required starting from 1:");
int n = in.nextInt();
System.out.println("Enter limit of the tables to be multiplied:");
int limit = in.nextInt();
tables ob = new tables();
ob.calculation(n,limit);
}
}

**Explanation:***In the main function we are getting the input from the user regarding number of tables and limit of the multiplication.Then we are invoking the function ***calculation** by passing those inputs and printing the table.

The output of the above program is:

You can download the source code.

### Like this:

Like Loading...

*Related*

## About Anuroop D

Very enthusiastic about technology and likes to share my knowledge through blogging. Has Bachelor's in Information Technology and currently pursuing my PhD in Computer Science.