In this example, i’ll show you how to use switch case for a range of number in C#. Example: C# static void Main(string[] args) { Console.Write("Number : "); int number=Convert.ToInt32(Console.ReadLine()); switch (number) {...
Tag - C# Switch Examples
Check Even or Odd Number Using switch case in C#
In this example, i’ll show you How to check even or odd number using switch case in C# Console App. C# Code: C# static void Main(string[] args) { int num; //Reading a number from user Console.Write("Enter any number to...
Create Simple Calculator using Switch Case in C#
In this example, i’ll show you How to create simple calculator using switch-case in C# Console App. C# Code: C# static void Main(string[] args) { int num1; int num2; string operand; float answer; Console.Write("Please enter...
Print Day of Week Name Using switch case in C#
In this example, i’ll show you How to Print day of week name using switch-case in C# Console App. C# Code: C# static void Main(string[] args) { int weeknumber; //Reading week no from user Console.WriteLine("Enter week...
Print Number of Days in a Month Using switch case in C#
In this example,i’ll show you How to print number of days in a month using switch case in C# Console App. C# Code: C# static void Main(string[] args) { int monthnumber; //Reading a month number from user Console...
Switch Examples in C#
What is a Switch Statement? A switch statement tests the value of a variable and compares it with multiple cases. Once the case match is found, a block of statements associated with that particular case is executed. Each case in...