乘法口诀表.

题目:编写一个程序,显示乘法口诀表。

代码:

public class Exmple5
{
 public static void main(String[] args)
 {
  int resule;
  for(int i=1;i<10;i++)
  {
   for(int j=1;j<10;j++)
   {
    resule=i*j;

//下面的if语句是为了保证输出时排列整齐。
    if(resule<=9)
    {
     System.out.print("    "+resule+"    ");
    }else{
     System.out.print(" "+resule+"    ");
      }
   }
           System.out.println();
  }
 }
}

posted @ 2009-02-01 06:12  WebVincent  阅读(573)  评论(0)    收藏  举报