class sanjiao
{
public static void sanjiao(int hang)
{ int count=1;
for(int i=1;i<=hang;i++)
{
for(int j=0;j<hang-i;j++)
{
System.out.print(" ");
}
if(i%2==1)
{ int l1=count;
for(int k=l1+i-1;k>=l1;k--)
{
System.out.print(k);
System.out.print(" ");
count++;
}
}
else
{
int l2=count;
for(int l=l2;l<=l2+i-1;l++)
{
System.out.print(l);
System.out.print(" ");
count++;
}
}
System.out.println("");
}
}
public static void main(String []args)
{
sanjiao(4);
}
}
posted on 2005-03-30 18:41
小力力力 阅读(288)
评论(0) 编辑 收藏 所属分类:
JAVA