你先看看能不能理解,不能理解在问我
class Tu
{
public static void main(String[] args)
{
for(int i = 0;i < 5;i++)
{
for(int j = i;j < 4;j++)
{
System.out.print(" ");
}
System.out.print("*");
for (int y=2*i-1;y>0;y-- )
{
System.out.print(" ");
}
if(i!=0)System.out.print("*");
System.out.println();
}
for (int m = 1;m <= 4 ;m++ )
{
for (int x = 1;x <= m ;x++ )
{
System.out.print(" ");
}
System.out.print("*");
for (int y=2*m-1;y<=5;y++ )
{
System.out.print(" ");
}
if(m!=4)System.out.print("*");
System.out.println();
}
}
}
|