代码:
class Testfourteen
{
public static void main(String[] args)
{
for (int a=1;a<=9;a++ )
{
for (int b=a;b<9;b++ )
{
System.out.print(" "+"\t");
}
for (int c=1;c<=a ;c++ )
{
System.out.print(a+"*"+c+"="+a*c+"\t");
}
for (int d=1;d<=a ;d++ )
{
System.out.print(a+"*"+d+"="+a*d+"\t");
}
System.out.println();
}
for (int a=9;a>=1 ;a-- )
{
for (int b=9;b>=a ;b--)
{
System.out.print(" "+"\t");
}
for (int c=1;c<=a;c++ )
{
System.out.print(a+"*"+a+"="+a*c+"\t");
}
for (int d=a;d>=1 ;d-- )
{
System.out.print(a+"*"+d+"="+d*a+"\t");
}
System.out.println();
}
}
}
效果图:
|
-
1.png
(91.54 KB, 下载次数: 6)
效果图
|