使用for循环输出三角形

public class Test {
public static void main(String[] args) {
//控制行
for (int i = 0; i < 5; i++) {
//控制列
for (int j = 0; j <=i; j++) {
//按列输出
System.out.print(“*”);
}
//控制机换行
System.out.println();
}
}

}

猜你喜欢

转载自blog.csdn.net/xzm616663858/article/details/69661028