Skip to main content

C#: Program #13 (Array)

using System;

namespace Arrays
{
    class Program
    {
        static void Main(string[] args)
        {
            Integralarray();
            Strings();
            Vague();
            Console.ReadKey();
        }

        public static void Integralarray()
        {

           int[] Numbers = new int[3];
            Numbers[0] = 123;
            Numbers[1] = 1255;
            Numbers[2]=12897;


            Console.WriteLine("Data type: {0}",Numbers.GetType());
            Console.WriteLine("Value of index 0: {0}",Numbers[0]);
            Console.WriteLine("Value of index 0: {0}", Numbers[1]);
            Console.WriteLine("Value of index 0: {0}", Numbers[2]);
        }
        public static void Strings()
        {
            string[] Names = {"Gray", "Ace", "Syler"};
            Console.WriteLine("Data type: {0}", Names.GetType());
            Console.WriteLine("Value of index 0: {0}", Names[0]);
            Console.WriteLine("Value of index 0: {0}", Names[1]);
            Console.WriteLine("Value of index 0: {0}", Names[2]);
        }
        public static void Vague()
        {
            var Vehicles =new[] { "Bike", "Bicycle", "Bus", "Boat" };
            var RealNumbers = new[] {12.345,13.89,90.444};
            var Vowels = new[] { "a", "e", "i", "o", "u" };

            Console.WriteLine("The datatype of vehicles is: {0}",Vehicles.GetType());
            Console.WriteLine("The datatype of realnumbers is: {0}",RealNumbers.GetType());
            Console.WriteLine("The datatype of Vowels is: {0}",Vowels.GetType());



        }
    }
}

Comments

Popular posts from this blog