Monday, 23 April 2018

Sum of two dimensional arrays


Sum of two dimensional arrays

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

namespace ConsoleApplication24
{
    class Program
    {
        static void Main(string[] args)
        {
            int i, j;
            int[,] a1 = new int[3, 3];
            int[,] a2 = new int[3, 3];
            int[,] a3 = new int[3, 3];
            Console.WriteLine("enter the first array values:");
            for (i = 0; i < 3; i++)
            {
                for (j = 0; j < 3; j++)
                {
                    a1[i, j] = Convert.ToInt32(Console.ReadLine());
                }
            }
            Console.WriteLine("enter the second array values:");
            for (i = 0; i < 3; i++)
            {
                for (j = 0; j < 3; j++)
                {
                    a2[i, j] = Convert.ToInt32(Console.ReadLine());
                }
            }
            Console.WriteLine("sum of two dimensional array:");
            for (i = 0; i < 3; i++)
            {
                for (j = 0; j < 3; j++)
                {
                    Console.Write("  " + (a1[i, j] + a2[i, j]));
                }
                Console.WriteLine();
            }
            Console.ReadLine();
        }
    }
}
https://www.youtube.com/channel/UCKLRUr6U5OFeu7FLOpQ-FSw/videos

0 comments

Post a Comment