Next-Gen App & Browser
Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles
To print the Multiplication table, enter any integer as input. Now use for loop from 1 to 10 to generate the Multiplication of that integer.
Following is the Java program that prints the Multiplication table of a number.
import java.util.Scanner;
public class MultiplicationTable {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter any number:");
int num = sc.nextInt();
for (int i = 1; i <= 10; i++) {
System.out.println(num + " * " + i + " = " + num * i);
}
}
}
Output
Enter number:6
6 * 1 = 6
6 * 2 = 12
6 * 3 = 18
6 * 4 = 24
6 * 5 = 30
6 * 6 = 36
6 * 7 = 42
6 * 8 = 48
KaneAI - Testing Assistant
World’s first AI-Native E2E testing agent.