99乘法表

 1 //99乘法口诀
 2     public static void main(String args[]) throws Exception{
 3         int i,j,n = 9;
 4         System.out.print(" * | 1  2  3  4  5  6  7  8  9 ");
 5         System.out.println();
 6         System.out.print("---|----------------------------");
 7         System.out.println();
 8         for (i = 1; i <= n; i++) {
 9             System.out.print(" " + i + " |");
10             for (j = 1;  j <= i; j++) {
11                 int test = i*j/10;
12                 if (test < 1) {
13                     System.out.print(" " + i*j + " ");
14                 }else if (test >= 1) {
15                     System.out.print(" " + i*j);
16                 }
17             }
18             System.out.println();
19         }
20     }

预览效果

posted on 2013-09-29 16:17  不死小小强  阅读(219)  评论(1编辑  收藏  举报

导航