Switch Statement
Programming Fundamentals DSA practice problem on Onlearn.
Difficulty: easy.
Topics: Switch Statements vs. If-Else Statements: Usage, Behavior, and Best Practices in Programming, Conditional Statements, Input/Output Operations, Data Types, String Manipulation, Time Complexity, Space Complexity, Range Checking, pattern matching, general programming, duplicate handling, expression evaluation, Switch Statement, Constant Expressions, Loop Control Statements.
Day of the Week Mapper Problem Statement Given an integer dayNum, your task is to determine and print the corresponding day of the week. Assume that 1 represents Monday, 2 represents Tuesday, and so on, up to 7 for Sunday. If the given dayNum is outside the valid range of 1 to 7, you should print "Invalid Day". Input Specification The input consists of a single integer dayNum. Output Specification Print the name of the day corresponding to dayNum. If dayNum is not within the range [1, 7], print "Invalid Day". Constraints 100 <= dayNum <= 100 Sample Test Cases Sample Input 1: Sample Output 1: Sample Input 2: Sample Output 2: Sample Input 3: Sample Output 3: Difficulty: Easy