WAP to print the table of a given number.

import java.util.*; class T10 { public static void main(String[] args) { int n; Scanner sc = new Scanner(System.in); System.out.print("Enter a number to get the table of that number: "); n = sc.nextInt(); System.out.println("Table of " + n + " is here: "); for (int i = 1; i <= 10; i++) { int t = n * i; System.out.println(n + " * " + i + " = " + t); } } } Copy Code
Expected Output:
Input:
Number: 7

Output:
Table of 7 is here:
7 * 1 = 7
7 * 2 = 14
7 * 3 = 21
7 * 4 = 28
7 * 5 = 35
7 * 6 = 42
7 * 7 = 49
7 * 8 = 56
7 * 9 = 63
7 * 10 = 70