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

How to output multiplication table in java

王林
Release: 2020-06-20 11:33:50
Original
4837 people have browsed it

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();
		}
	}
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template