C Sharp for Beginners/Arrays

From Wikibooks, open books for an open world
Jump to: navigation, search

using System;

Public Class TwoD {

   public static void Main(string [] args)
   {
       int[,]a = int[2,2];
       int i,j;
       Console.WriteLine("Enter elements in the array:");
       for(i=0;i<2;i++)
       {
           for(j=0;j<2;j++)
           {
               a[i,j]=Convert.ToInt32(Console.ReadLine());
           }
       }
   }

}