Multiplication Table Example Java Program


Definition

A multiplication table (a times table) is a mathematical table used to define a multiplication operation for an algebraic system. Tables can also define binary operations on groups, fields, rings, and other algebraic systems.

Multiplication Table Example Program

import java.util.Scanner;
 
class MultiplicationTable{
	public static void main(String args[]){
		int num;
		System.out.println("Which multiplication table do you need?");
		Scanner in = new Scanner(System.in);
		num = in.nextInt();
		System.out.println("Multiplication table of "+num+" is :");
		for (int i = 1 ; i <= 10 ; i++ ){
			System.out.println(num+"*"+i+" = "+(num*i));
		}
	}
}

Sample Output

Output is:
Which multiplication table do you need?
5
Multiplication table of 5 is :
5*1 = 5
5*2 = 10
5*3 = 15
5*4 = 20
5*5 = 25
5*6 = 30
5*7 = 35
5*8 = 40
5*9 = 45
5*10 = 50