public class Chengfademo { public Chengfademo() { } public static void main(String[] args) { for(int i = 1; i <= 9; ++i) { for(int j = 1; j <= i; ++j) { System.out.print(i + "*" + j + "=" + i * j + "\t"); } System.out.println(" "); } } }
得到结果
public class Sanjiaodemo { public Sanjiaodemo() { } public static void main(String[] args) { for(int i = 1; i <= 5; ++i) { int p; for(p = 1; p <= 5 - i; ++p) { System.out.printf(" "); } for(p = 1; p <= i; ++p) { System.out.printf("*"); } for(p = 1; p <= i - 1; ++p) { System.out.printf("*"); } System.out.println(); } } }
得到结果
标签:String,int,void,Sanjiaodemo,循环,三角形,乘法表,public From: https://www.cnblogs.com/Chengjuice/p/17573307.html