/*
打印 行数为5的等腰三角形 如下
*
***
*****
*******
*********
*/
public class Text06 {
public static void main(String[] args) {
for (int i = 1; i <= 5 ; i++) {
for (int j = 1; j <= 9; j++) {
if((j - 5) >= i || (j - 5) <= -i ){
System.out.print(" ");
}else{
System.out.print("* ");
}
}
System.out.println();
}
}
} |
|