using System;
class Program
{
static void Main(string[] args)
{
int i;
i = 0;
Console.WriteLine("Enter any number: ");
i = Convert.ToInt32(Console.ReadLine());
switch (i)
{
case 1:
Console.WriteLine("One");
break;
case 2:
Console.WriteLine("TWO");
break;
case 3:
Console.WriteLine("Three");
break;
default:
Console.WriteLine("invalid Number");
break;
}
Console.ReadLine();
}
}
class Program
{
static void Main(string[] args)
{
int i;
i = 0;
Console.WriteLine("Enter any number: ");
i = Convert.ToInt32(Console.ReadLine());
switch (i)
{
case 1:
Console.WriteLine("One");
break;
case 2:
Console.WriteLine("TWO");
break;
case 3:
Console.WriteLine("Three");
break;
default:
Console.WriteLine("invalid Number");
break;
}
Console.ReadLine();
}
}
1 comment:
This is a very helpful and beginner-friendly explanation of how to use a simple switch case in C#.Net 2008. The examples make it easy to understand how switch statements improve code readability compared to multiple if-else conditions. Such clarity is especially useful for students working on programming tasks and assignments. For learners who still face challenges while implementing concepts like switch case logic, referring to a reliable assignment provider australia can be a great support. Overall, this post does a great job of breaking down a core C# concept in a simple and practical way.
Post a Comment