create a console application to test usage of switch case construct. Accept some integer from user as command line argument and using a switch case construct
class Program
{
static void Main()
{
int number = int.Parse(Console.ReadLine());
switch (number)
{
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
Console.WriteLine("Your number is between 1 - 10");
break;
default:
Console.WriteLine("Your number is not between 1 - 10");
break;
}
}
}
Comments
Leave a comment