C# Program to Print Day Name of Week

In this C# program, we will take the input from the user and print day name of week.

C# Program to Print Day Name of Week Code:

private static void Main(string[] args)
        {
            int weekday;
            Console.Write("Please Enter the Day Number From 1 to 7: ");
            weekday = int.Parse(Console.ReadLine());

            switch (weekday)
            {
                case 1:
                    Console.WriteLine("Today is Monday");
                    break;
                case 2:
                    Console.WriteLine("Today is Tuesday");
                    break;
                case 3:
                    Console.WriteLine("Today is Wednesday");
                    break;
                case 4:
                    Console.WriteLine("Today is Thursday");
                    break;
                case 5:
                    Console.WriteLine("Today is Friday");
                    break;
                case 6:
                    Console.WriteLine("Today is Saturday");
                    break;
                case 7:
                    Console.WriteLine("Today is Sunday");
                    break;
                default:
                    Console.WriteLine("Please enter Valid Number between 1 to 7");
                    break;
            }

            Console.ReadLine();
        }

C# Program to Print Day Name of Week Output:

CSharp-program-to-Print-Day-Name-of-Week

CSharp-program-to-Print-Day-Name-of-Week

 
About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2024 CodingFusion
50+ C# Programs for beginners to practice