Print Multiplication Tables Of Any Number In Java

Sharing is healthy !!

Today we will print multiplication tables of any number in java.

example: Print Multiplication Tables Of Any Number In Java

Also Read¬†–¬†Java Program To Find Prime Number

import java.util.Scanner;

public class Print_Multiplication_Tables {

public static void main(String[] args) {
 
int a;
int b;
 
System.out.println("Please enter an integer to print multiplication tables: ");
Scanner sc = new Scanner(System.in);
a = sc.nextInt();
System.out.println("Multiplication table of " + a + " is: ");
 
for(b = 1;b <= 10;b++)
System.out.println(a + " * " + b + " = " + (a * b));
}
}

Output:

Print Multiplication Tables Of Any Number In Java

The above example is not restricted to five multiplication table. You can print any number multiplication from above example.

Sharing is healthy !!