等腰三角形
Posted yrswby2016
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了等腰三角形相关的知识,希望对你有一定的参考价值。
/**
* 打印等腰5*5的等腰三角形
*/
public class TestDeng {
public static void main(String[] args) {
//1.定义for循环的遍历
for (int i = 1; i < 6; i++) {
for (int j = 0; j < 6 - i;j++){
System.out.print(" "); //倒立的三角形,注意不要换行
}
for(int j = 0; j < i; j++){
System.out.print("* ");//注意这里有一个空格
}
System.out.println();
}
}
}
以上是关于等腰三角形的主要内容,如果未能解决你的问题,请参考以下文章