Q:

Loopin Statement : for each Statement using C# Language

0

This Program is used to store the elements using for each statement

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;



public class exam

 {

    public static void Main()

    {

      string[] arr =new string[5];



      arr[0] ="Steven";

      arr[1] ="Clark";

      arr[2] ="Mark";

      arr[3] ="Thompson";

      arr[4] ="John";



//retrieving value using foreach loop

foreach(string name in arr)

   {

       Console.WriteLine("\nHello "+ name);

   }

  }

}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now