bool a = true;
while (a)
{
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("1: For Integer array ");
Console.WriteLine("2: For String array");
int choice;
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Enter Your choice..... ");
choice = Convert.ToInt32(Console.ReadLine());
switch (choice)
{
case 1:
integer();
break;
case 2:
Strarrry();
break;
case 3:
Environment.Exit(0);
break;
}
// Console.ReadKey();
}
}
static void integer()
{
int[] number = { 1, 2, 3, 4, 5 };
for (int i = 0; i < number.Length; i++)
{
Console.ForegroundColor = ConsoleColor.DarkYellow;
Console.WriteLine("Integer ");
Console.WriteLine(number[i]);
}
Console.ReadLine();
}
static void Strarrry()
{
Console.ForegroundColor = ConsoleColor.Magenta;
string[] names=
{"asim iqbal",
"ahmad but",
"M.zeeshan",
"Raheel,all"};
foreach(string value in names)
{
Console.WriteLine(value);
}
while (a)
{
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("1: For Integer array ");
Console.WriteLine("2: For String array");
int choice;
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Enter Your choice..... ");
choice = Convert.ToInt32(Console.ReadLine());
switch (choice)
{
case 1:
integer();
break;
case 2:
Strarrry();
break;
case 3:
Environment.Exit(0);
break;
}
// Console.ReadKey();
}
}
static void integer()
{
int[] number = { 1, 2, 3, 4, 5 };
for (int i = 0; i < number.Length; i++)
{
Console.ForegroundColor = ConsoleColor.DarkYellow;
Console.WriteLine("Integer ");
Console.WriteLine(number[i]);
}
Console.ReadLine();
}
static void Strarrry()
{
Console.ForegroundColor = ConsoleColor.Magenta;
string[] names=
{"asim iqbal",
"ahmad but",
"M.zeeshan",
"Raheel,all"};
foreach(string value in names)
{
Console.WriteLine(value);
}