Home  >  Article  >  Java  >  Java classic programming questions--ninety-nine multiplication tables

Java classic programming questions--ninety-nine multiplication tables

零下一度
零下一度Original
2017-06-25 10:23:031822browse

输出九九乘法表。

public class Example16 {
    public static void main(String[] args) {
        table(9);
    }

    public static void table(int n) {
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print(j + "*" + i + "=" + j * i+"\t");
            }
            System.out.println();
        }
    }
}

The above is the detailed content of Java classic programming questions--ninety-nine multiplication tables. 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