package instance3;
public class PrintTriangle {
public void printTriangle(int row){
//循环行打印
for(int rowIndex = 1; rowIndex<=row;rowIndex++){
//打印空格
for(int i = 0 ; i < row-rowIndex ;i++){
System.out.print(" ");
}
//打印*
for(int i = 0 ;i < rowIndex;i++){
System.out.print("* ");
}
System.out.println();
}
}
public static void main(String[] args) {
PrintTriangle printTriangle = new PrintTriangle();
printTriangle.printTriangle(10);
}
}