004-003-007
Switch Statement: Weekday Determination
Easy
Problem Description
switch statement: Weekday Determination
Learning Objective: Perform multi-value branching with switch statement
In this problem, you will create a program that reads an integer (1-7) from standard input, uses a switch statement with cases 1 through 7 to determine the corresponding weekday name, and displays the result in the format "[Weekday]" to standard output.
Determine weekday from number (1-7). Display weekday name using switch statement.
Input
Line 1: Weekday number (integer 1-7)
Output
[Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday]
1=Monday, 2=Tuesday, ..., 7=Sunday.
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up