本帖最后由 下一页5 于 2015-5-8 19:02 编辑
/*
作者;下一页5
功能实现打印出两个完全对称的乘法表
1X1=1
2X1=2 2X2=4
3X1=3 3X2=6 3X3=9
4X1=4 4X2=8 4X3=12 4X4=16
5X1=5 5X2=10 5X3=15 5X4=20 5X5=25
6X1=6 6X2=12 6X3=18 6X4=24 6X5=30 6X6=36
7X1=7 7X2=14 7X3=21 7X4=28 7X5=35 7X6=42 7X7=49
8X1=8 8X2=16 8X3=24 8X4=32 8X5=40 8X6=48 8X7=56 8X8=64
9X1=9 9X2=18 9X3=27 9X4=36 9X5=45 9X6=54 9X7=63 9X8=72 9X9=81
9x1=9 9x2=18 9x3=27 9x4=36 9x5=45 9x6=54 9x7=63 9x8=72 9x9=81
8x1=8 8x2=16 8x3=24 8x4=32 8x5=40 8x6=48 8x7=56 8x8=64
7x1=7 7x2=14 7x3=21 7x4=28 7x5=35 7x6=42 7x7=49
6x1=6 6x2=12 6x3=18 6x4=24 6x5=30 6x6=36
5x1=5 5x2=10 5x3=15 5x4=20 5x5=25
4x1=4 4x2=8 4x3=12 4x4=16
3x1=3 3x2=6 3x3=9
2x1=2 2x2=4
1x1=1
*/
- <P>class KaoShi</P>
- <P>{
- public static void main(string[]args)
- {
- cfb();
- cfb1();
- }
- public static void cfb()
- {
- for (int a=1;a<10 ;a++ )
- {
- for (int b=1;b<=a ;b++ )
- {
- System.out.print(a+"X"+b+"="+a*b+"\t");
- }
- System.out.println();
- }
- }
- public static void cfb1()
- {
- for (int m=9;m>0 ;m-- )
- {
- for (int n=1;n<=m ;n++ )
- {
- System.out.print(m+"x"+n+"="+m*n+"\t");
- }
- System.out.println();
- }
- }
- }</P>
复制代码 |
|