1 package debug;
 2 
 3 public class Demo10 {
 4     public static void main(String[] args) {
 5         //用星星符号打印出一个直角三角形
 6         for(int i=1;i<=5;i++) {
 7             //每一列打印的星星个数跟行数相同 ,所以在下面for循环中将条件中最大值设置为行数
 8             for(int j=1;j<=i;j++) {
 9                 System.out.print("*");
10             }
11             System.out.println();
12         }
13     }
14 
15 }

输出如下:

*
**
***
****
*****

  

相关文章:

  • 2022-12-23
  • 2021-09-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-01
猜你喜欢
  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2022-12-23
  • 2021-06-09
  • 2021-11-08
相关资源
相似解决方案