As i have added 3rd option i.e to exit from console. When i am pressing any key other than 1 and 2.it is not exiting from console.It is still asking user to select from following menu. updated/////////
static void Main(string[] args)
{
bool returntype = true;
while (true)
{
returntype = main();
}
}
static bool main()
{
Console.WriteLine("please select from the following");
Console.WriteLine("Press 1 to print even numbers below 20");
Console.WriteLine("Press 2 to print odd numbers below 20");
Console.WriteLine("Press any other key to exit");
string option = (Console.ReadLine());
if (option == "1")
{
evenfx();
return true;
}
else if (option == "2")
{
oddfx();
return true;
}
else
{
return false;
}
}
// after adding exit option it look like this.