using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MyArray { class Program { static void Main(string[] args) { Console.WriteLine("enter the first dimention of array 1:"); int array1D1=Convert.ToInt32(Console.ReadLine()); Console.WriteLine("enter the second dimention of array 1:"); int array1D2 = Convert.ToInt32(Console.ReadLine()); int[,] array1 = new int[array1D1, array1D2]; for (int i = 0; i < array1D1; i++) { for (int x = 0; x < array1D2; x++) { Console.WriteLine("Enter value integer:"); array1[i, x] = Convert.ToInt32(Console.ReadLine()); } } /////////////////////////////////////////////////////////////////////// Console.WriteLine("enter the first dimention of array 2:"); int array2D1 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("enter the second dimention of array 2:"); int array2D2 = Convert.ToInt32(Console.ReadLine()); int[,] array2 = new int[array2D1, array2D2]; for (int i = 0; i < array2D1; i++) { for (int x = 0; x < array2D2; x++) { Console.WriteLine("Enter value integer:"); array1[i, x] = Convert.ToInt32(Console.ReadLine()); } } /////////////////////////////////////////////////////////////////////// int[,] res = new int[2, 2]; res[0, 0] = array1[0, 0] + array2[0, 0]; res[0, 1] = array1[0, 1] + array2[0, 1]; res[1, 0] = array1[1, 0] + array2[1, 0]; res[1, 1] = array1[1, 0] + array2[1, 1]; //foreach (int i in res) //{ // Console.WriteLine("{0}",i); //} Console.WriteLine(" {0} + {1} = {2}", array1[0,0],array2[0,0],res[0, 0]); Console.WriteLine(" {0} + {1} = {2}", array1[0, 1], array2[0, 1], res[0, 1]); Console.WriteLine(" {0} + {1} = {2}", array1[1, 0], array2[1, 0], res[1, 0]); Console.WriteLine(" {0} + {1} = {2}", array1[1, 1], array2[1, 1], res[1, 1]); Console.ReadKey(); } } }