public class WorkDemo05 {
/*
* 需求:
* *
* ***
* *****
* *******
* *********
* 输出上述矩阵
*/
public static void main(String[] args) {
for(int a = 1;a < 6;a++){
for(int b = a;b < 5;b++){
System.out.print(" ");
}
for(int c = a;c < a*3-1;c++){
System.out.print("*");
}
System.out.println();
}
}
}
总结:1.外层循环一次,内层循环一遍
2.*号部分运用等差数量来完成指定数量排列