二維陣列九九乘法表 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 二維陣列九九乘法表
{
    class Program
    {
        static void Main(string[] args)
        {
            int[,] A = new int[2, 9] { { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, { 1, 2, 3, 4, 5, 6, 7, 8, 9 }};   //2=0~1(乘數跟被乘數)  9(0~9參數 )

            for (int i = 0; i <= 8; i++)
            {
                for (int j = 0; j <= 8; j++)
                {
                    Console.Write(A[0, i] + "*" + A[1, j] + "=" + A[0, i] * A[1, j] +'\t');
                }

                Console.WriteLine();    //等同Console.Write('\n');
                   
               
            }
            Console.ReadLine();
        }
    }
}

 


 

執行結果

 

未命名.jpg  

arrow
arrow
    文章標籤
    二維陣列 九九乘法表 c#
    全站熱搜

    ㄡ ㄋㄧ' ㄦ 發表在 痞客邦 留言(0) 人氣()