Tuesday 21 February 2017

printing numbers using foreach in c#

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

namespace ConsoleApplication51
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] intarray = { 1, 2, 3, 4, 5, 6 };

            foreach (int i in intarray)
            {
                Console.WriteLine(i);
            }

            Console.ReadLine();
        }
    }

}

output screenshot:

No comments:

Post a Comment