Answers for "switch statement csharp"

C#
0

csharp switch case

using System;
					
public class Program
{
	public static void Main()
	{
		Console.WriteLine("Enter a number");
		
		int number = Convert.ToInt32(Console.ReadLine());
		
		switch (number)
      	{
          case 1:
			  Console.Clear();
              Console.WriteLine("one");
              break;
          case 2:
			  Console.Clear();
              Console.WriteLine("two");
              break;
          default:
			  Console.Clear();
              Console.WriteLine("Default case");
              break;
      	}							
	}
}
Posted by: Guest on February-10-2021

C# Answers by Framework

Browse Popular Code Answers by Language