Multiplication Table In Java Example
Chapter:
Miscellaneous
Last Updated:
18-07-2016 04:42:01 UTC
Program:
/* ............... START ............... */
import java.util.Scanner;
public class JavaMultiplicationTable {
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));
}
}
/* ............... END ............... */
Output
Enter an integer to print it's multiplication table
10
Multiplication table of 10 is :-
10*1 = 10
10*2 = 20
10*3 = 30
10*4 = 40
10*5 = 50
10*6 = 60
10*7 = 70
10*8 = 80
10*9 = 90
10*10 = 100
Notes:
-
A multiplication table is a table of numbers which lists product of a decimal sequence of numbers.
Tags
Multiplication Table, Java