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

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more