class Demo
{
public static void main(String[] args)
{
for (int m=1;m<=5 ;m++ )
{
for (int n=++m;n<=5 ;n++ )
{
System.out.print(" ");
}
for (int a=1;a<m ;a++ )
{
System.out.print(" *");
}
System.out.println();
}
for (int x=2;x<=5 ;x++ )
{
for (int y=0;y<x ;y++ )
{
System.out.print(" ");
}
for (int z=++x;z<=5 ;z++)
{
System.out.print(" *");
}
System.out.println();
}
}
}
你可以参考一下。 |