class lingXing
{
public static void main(String[] args)
{
int p=9;
//先打印上半部分
for (int x=0;x<p ;x++ )
{
for (int y=x;y<p-1 ;y++ )
{
System.out.print(" ");//打印空格
}
for (int z=0;z<2*x+1 ;z++ )
{
System.out.print("*");//打印*
}
System.out.print("\n");
}
//打印下半部分
for (int x=0;x<p-1 ; x++)
{
for (int y=0;y<x+1 ;y++ )
{
System.out.print(" ");//打印空格
}
for (int m=2*(p-x-1)-1;m>0 ;m-- )
{
System.out.print("*"); //打印*
}
System.out.print("\n");
}
}
} |
|