Foreach Loop

using System; namespace foreach_loop { class Program { static void Main(string[] args) { string[] arr = new string[5]; // declaring array........ //Storing value in array element,,,, 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("Hellooo " + name); } Console.ReadLine(); } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.