Write a java program to print multiplication table using for loop

Write a java program to print multiplication table using for loop. In the Java application, print the mathematics tables. As a novice in the Java programming language, this software is even more impressive and expands the programming ideas. The method of obtaining a product by combining matrices, vectors, or other quantities according to particular laws.

import java.util.Scanner;
public class Main
{
public static void main(String args[])
{
int number, i, tab;
Scanner scan = new Scanner(System.in);
System.out.print("Enter a numbers");
number = scan.nextInt();
System.out.print("Table of " + number + " is\n");
for(i=1; i<=5; i++)
{
tab = number*i;
System.out.print(number + " * " + i + " = " + tab + "\n");
}
}
}

 

Output:

Enter a numbers

2

Table of 2 is

2 * 1 = 2

2 * 2 = 4

2 * 3 = 6

2 * 4 = 8

2 * 5 = 10

For loop program to print the multiplication in java

A for loop is a repetition control structure that allows you to construct a loop that must be repeated a certain number of times quickly. 

When you know how many times a task will be repeated, a for loop comes in handy. A “For” Loop is used to repeat a block of code for a certain number of times. 

If we wish to verify every student’s grade in the class, for example, we loop from 1 to that number.

Scanner program in java to receive the multplication

The scanner is a class in the Java util package that is used to get the input of primitive kinds such as int, double, and strings.

It’s the simplest way to read input in a Java program, but it’s inefficient if you need an input method for situations where speed is a factor, such as competitive programming.