java program to print multiplication table of multiple numbers code example

Example: Java program to print multiplication table of any number

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

Tags:

Java Example