public static void main(String args[]){
int rows,n;
rows=n=5;
printStars(n,rows);
}
public static void printStars(int n,int rows){
if(n==0){
return;
}else{
printStars(n-1,rows);
for(int i=0;i<rows;i++){
if(i<rows-n){
System.out.print(" ");}else{
System.out.print("* ");
}
}
System.out.println();
}
}
}
這個應該是正確的,妳試壹下吧,只用了壹個for循環