1042. Switch Case

Given the integer day denoting the day number, print on the screen which day of the week it is. Week starts from Monday and for values greater than 7 or less than 1, print Invalid.

Ensure only the 1st letter of the answer is capitalised.

For printing use:-

  • for C++ : cout << variable_name;
  • for Java : System.out.print();
  • for Python : print()
  • for Javascript : console.log()

Example 1:

Input: day = 3

Output: Wednesday

Example 2:

Input: day = 8

Output: Invalid

Now Your Turn!

Pick the correct output for the given input

Input: day = 2

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 0 <= day <= 50
0
class Solution {
public:
void whichWeekDay(int day) {
 
}
};
Test Case

Input:

Day