Home  >  Article  >  Java  >  How to output multiplication table in java

How to output multiplication table in java

王林
王林Original
2020-06-20 11:33:504805browse

How to output multiplication table in java

Implementation idea: We can implement it through double for loops. The outer loop controls the number of rows and the inner loop controls the columns, so that the multiplication table can be printed out.

(Recommended tutorial: java entry program)

Implementation code:

public class Demo {
 
	public static void main(String[] args) {
 
		for (int i = 1; i <10; i++) {
 
			for (int j = 1; j <= i; j++) {
 
				System.out.print(j + "*" + i + "=" + i * j + "  ");
 
			}
			System.out.println();
		}
	}
}

Output result:

How to output multiplication table in java

Recommended related video tutorials: java video tutorial

The above is the detailed content of How to output multiplication table in java. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn