Week Number to Day of the Week

Explanation:

  1. Input:
    • The program prompts the user to enter a week number between 1 and 7.
  2. Switch Statement:
    • The switch statement checks the value of weekNumber.
    • Each case corresponds to a specific day of the week:
      • case 1: Outputs “Sunday.”
      • case 2: Outputs “Monday.”
      • case 3: Outputs “Tuesday.”
      • case 4: Outputs “Wednesday.”
      • case 5: Outputs “Thursday.”
      • case 6: Outputs “Friday.”
      • case 7: Outputs “Saturday.”
    • The default case handles any input outside the range of 1-7, displaying an error message.
  3. Output:
    • Depending on the input, the program prints the corresponding day of the week.

      Example Outputs:

      Example 1: Valid Input

      Input:

      • Week Number: 3

      Output:

      Example 2: Valid Input

      Input:

      • Week Number: 6

      Output:

      Example 3: Invalid Input

      Input:

      • Week Number: 8

      Output: