Thursday, 28 November 2013

C# Implementation of For N Foreach in the same program-----|||||||||

CODE:

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

namespace CSharpForNForeach
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a;
            a = new int[7];
            for (int i = 0; i < 7; i++)
            {
                a[i] = int.Parse(Console.ReadLine());
            }
            Console.WriteLine("\n");
            Console.WriteLine("-------Numbers that You have entered are--------:");
            Console.WriteLine("\n");
            foreach (int m in a)
            {
                Console.WriteLine(" " + m);

            }
            Console.WriteLine();
            Console.ReadKey();
        }
    }
}

OUTPUT:

No comments:

Post a Comment