Tech Study

Write Program To Print Day of Week Name In c# switch case

Introduction:

C# switch case

I have used Visual Studio 2012 for debugging purpose. But you can use any version of visual studio as per your availability.for finding Day of Week Name In c# switch case

using System;
 
public class csharpExercise
{
    static void Main(string[] args)
    {             
 
     int weeknumber;
 
     //Reading week no from user
     Console.WriteLine("Enter week number(1-7): ");
     weeknumber = Convert.ToInt32(Console.ReadLine());
 
     switch (weeknumber)
    {
        case 1: Console.WriteLine("Monday");
            break;
        case 2: Console.WriteLine("Tuesday");
            break;
        case 3: Console.WriteLine("Wednesday");
            break;
        case 4: Console.WriteLine("Thursday");
            break;
        case 5: Console.WriteLine("Friday");
            break;
        case 6: Console.WriteLine("Saturday");
            break;
        case 7: Console.WriteLine("Sunday");      
            break;
        default:
            Console.WriteLine("Invalid input! Please enter week no. between 1-7.");
            break;
 
      }
    Console.ReadLine();
 
    }
}

c# switch case

Result

Write program to print day of week name in c# switch case
Write  program to print day of week name in c# switch case

TaggedWrite C program to print day of week name using switch case

Python Examples

Introduction: Python Examples are the basic programming concepts of python like python syntax,python data types,,python operators,python if else,python comments etc.. …

Read more

C String Functions

C String Functions perform certain operations, It provides many useful string functions which can come into action. The <string.h> header …

Read more