Answer to Question #251297 in C# for Hilok

Question #251297
Create a program to output the day of the week according to the number entered on the keyboard.
1
Expert's answer
2021-10-16T11:03:38-0400
using System;
					
public class Program
{
	public static void Main()
	{
		Console.Write("Enter the day of the week:");
		String str = Console.ReadLine();
		
		String day = "";
		switch (str) {
			case "1":
				day = "Monday";
				break;
			case "2":
				day = "Tuesday";
				break;
			case "3":
				day = "Wednesday";
				break;
			case "4":
				day = "Thursday";
				break;
			case "5":
				day = "Friday";
				break;
			case "6":
				day = "Saturday";
				break;
			case "7":
				day = "Sunday";
				break;
		}
		
		Console.WriteLine("The day is "+day);
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS