如何用java打印出實(shí)心的等腰三角形?
int row=5;
for (int i = 0; i <= 5; i++){
for( int j=0;j<=row-i-1;j++ ) {
System.out.print(" "); //打印空格直角倒三角
} for (int j = 0; j <= i * 2 + 1; j++) {
System.out.print("*"); //打印等腰三角形
} System.out.println();
}
如何用java打印出實(shí)心的等腰三角形?
int row=5;
for (int i = 0; i <= 5; i++){
for( int j=0;j<=row-i-1;j++ ) {
System.out.print(" "); //打印空格直角倒三角
} for (int j = 0; j <= i * 2 + 1; j++) {
System.out.print("*"); //打印等腰三角形
} System.out.println();
}