Java 实例 – 打印倒立的三角形
Java 教程
· 2019-02-10 19:13:13
打印倒立的三角形。
实例
public class InvertedTriangle {
public static void main(String[] args) {
//打印倒立的三角形
for (int m = 1; m <= 4; m++) {
//打印空格
for (int n = 0; n <= m; n++) {
System.out.print(" ");
}
//打印*
for (int x = 1; x <= 7 -2 * (m - 1); x++) {
System.out.print("*");
}
System.out.println();
}
}
}
输出结果:
*******
*****
***
*
点击查看所有 Java 教程 文章: https://www.codercto.com/courses/l/12.html
Effective Modern C++
Scott Meyers / O'Reilly Media / 2014-12 / USD 49.99
Learn how to program expertly with C++ with this practical book from Scott Meyers, one of the world's foremost authorities on this systems programming language. Scott Meyers takes some of the most dif......一起来看看 《Effective Modern C++》 这本书的介绍吧!