You are on page 1of 1

Lab 2

Problem Statement:

Write a C# program in Visual Studio: create an array of String type and initialize it with some
names, then print all the names on the console using for each loop.

Mechanism to Conduct Lab:

Students and teacher communicate through Skype/Adobe Connect.

Solution:

{
class Program
{
static void Main(string[] args)
{
string[] myarray = new string[]{ "Bilal", "Asad", "Saad",
"kamran" };

foreach (String name in myarray ) {


Console.WriteLine("Name is:"+ name);
}

Console.ReadKey();
}
}
}

You might also like