Java Print Multiplication Table Program

Multiplication tables are difficult to learn but simple to create using programming.  Java Print Multiplication Table Program will make you learn to use the FOR LOOP to generate and present multiples of a given number as a multiplication table.  

The program given as an example here reads the number of for which the multiplication table has to be generated. This program gives the additional flexibility to user to choose the number that how many multiples to be displayed. It displays the multiplication table in following format

Number X multiple count= multiple value

Java Multiplication Table Code

Here is the java code to print the Multiplication Table for given number.

import java.util.Scanner;
public class MultiplyTable 
{
	public static void main(String[] args) 
	{
		Scanner scObj= new Scanner(System.in);
		//Read the number from user
		System.out.println("Enter the Number to generate Multiplication Table");
		int intMulNum = scObj.nextInt();
		//Read number of multiples from user
		System.out.println("Enter the Number of multiples generate Multiplication Table");
		float intMulTo = scObj.nextFloat();
		//Print Table
		System.out.println("table for "+intMulNum);
		for (int i=1; i<=intMulTo;i++)
		{
			System.out.println(intMulNum+"X"+i+"=" +intMulNum*i);
		}
	}
} 

Output

Java Print Multiplication Table