public class xinghao {
public static void main(String args[]) {
for(int i=1;i<=5;i++){
for(int j=1;j<=5-i;j++){
System.out.print(" ");}
for(int k=1;k<=i;k++) {
System.out.print("* "); ----星号后面有一个空格
}
System.out.println();
}
}
}
operation result:
*
* *
* * *
* * * *
* * * * * Analysis: The two cycles in a row, j and k are independent, clear relationship to debate them, otherwise the result of the output is wrong, the most important or consider carefully the inner loop contains relations