Pages

Print Multiplication table



Write a Program to Print Multiplication table?

This java program prints multiplication table of a number entered by the user using a for loop.

Souce code of the Program:

import java.util.Scanner;
class MultiplicationTable
{
public static void main(String args[])
{
      int n, c;
      System.out.println("Enter an integer to print it's multiplication table");
      Scanner in = new Scanner(System.in);
      n = in.nextInt();
      System.out.println("Multiplication table of "+n+" is :-");

      for ( c = 1 ; c <= 10 ; c++ )
      System.out.println(n+"*"+c+" = "+(n*c));
}
}

Output of the Program: