Friday, October 20, 2017

Two Dimensional Arrays in C#

A very simple program that I wrote using C# as my programming language to show and demonstrate the concepts of two dimensional array.


I am currently accepting programming work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.




Sample Program Output


Program Listing

two_dimensional.cs


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

namespace two_dimensional
{
    class two_dimensional
    {
        static void Main(string[] args)
        {
            int[,] values = 
            { 
                {10, 20, 30, 40}, // row 0 values 
                {50, 60, 70, 80}, // row 1 values 
                {90, 100, 110, 120}, // row 2 values 
            };
            Console.Write("\n\n");
            Console.Write("\t  Two Dimensional Array Demonstration Program ");
            Console.Write("\n\n\n");
            for (int row = 0; row < values.GetLength(0); row++)
            {
                for (int col = 0; col < values.GetLength(1); col++)
                {
                    Console.Write("  {0}  " ,values[row, col]);
                }
            }
            Console.Write("\n\n\n");
            Console.Write("\t    Thank You For Using This Software.");
            Console.ReadKey();
        }
    }

}

No comments:

Post a Comment