返回列表 發帖
  1. using ConsoleApp1;
  2. using System;//程式庫呼叫
  3. using System.ComponentModel.DataAnnotations;
  4. using System.Linq.Expressions;
  5. using ABC.qq;


  6. class Program//負責一部分工作的人
  7. {
  8.     const string dreams = "There are moments in life when you miss someone so much that " +
  9.     "you just want to pick them from your dreams and hug them for real! Dream what " +
  10.     "you want to dream;go where you want to go;be what you want to be,because you have " +
  11.     "only one life and one chance to do all the things you want to do";
  12.     static void Main()//method ..Entry Point 程式進入點
  13.     {
  14.         try
  15.         {
  16.             int x1 = 0;
  17.             x1=Convert.ToInt32(Console.ReadLine());
  18.             if(x1>9)
  19.             {
  20.                 throw new ArgumentException();
  21.             }
  22.             int k;
  23.             for(int i=1;i<=x1;i++)
  24.             {
  25.                 for(int j=i;j>=1;j--)
  26.                 {
  27.                     Console.Write("{0}*{1}={2,-4:00}",i,j,i*j);//寬度為4個字元,需靠左對齊。
  28.                 }
  29.                 Console.WriteLine();
  30.             }
  31.         }
  32.         catch
  33.         {
  34.             Console.WriteLine("error");
  35.         }
  36.     }
  37. }
複製代碼
istak.teach2@gmail.com

TOP

返回列表