Friday, October 20, 2017

Array Demonstration in C#

A very simple program that I wrote using C# to demonstration array as our data structure.  The code is very short and easy to understand.

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


array_demo.cs


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

namespace array_demo
{
    class array_demo
    {
        static void Main(string[] args)
        {
            int[] values = new int[12]; /* values is an array of 5 integers */
            int a = 0, b = 0;

            /* initialize elements of array values*/
            for (a = 0; a < 12; a++)
            {
                values[a] = a + 100;
            }

            Console.Write("\n\n");
            Console.Write("\t      Array Demonstration Program ");
            Console.Write("\n\n");
            /* output each array element's value */
            for (b = 0; b < 12; b++)
            {
                Console.WriteLine("\t\t Element[{0}] = {1}", b, values[b]);
            }
            Console.Write("\n\n");
            Console.Write("\t Thank You For Using This Software.");
            Console.ReadKey();
        }
    }

}

No comments:

Post a Comment