C Program to Print Days of Week in Words using Switch Case Statement

In this C program, we will print name of days of week using switch case statement. We will take a number between 1 to 7 as input from user, where 1 corresponds to Monday, 2 corresponds to Tuesday and so on. We will use switch case statement to print name of day in words.

Required Knowledge


C program to print name of day using switch case statement

#include <stdio.h> 
  
int main() {  
    int day;
  
    printf("Enter Day Number\n");  
    scanf("%d", &day);  _
 
    switch(day){
        case 1 : printf("Monday\n");
            break;
        case 2 : printf("Tuesday\n");
            break;
        case 3 : printf("Wednesday\n");
            break;
        case 4 : printf("Thursday\n");
            break;
        case 5 : printf("Friday\n");
            break;
        case 6 : printf("Saturday\n");
            break;
        case 7 : printf("Sunday\n");
            break;
        default: printf("Invalid Input !!!!\n");          
    }
 
    return 0;  
}
Output
Enter Day Number
4
Thursday
Enter Day Number
7
Sunday
Enter Day Number
12
Invalid Input !!!!

Related Topics
C program to find maximum of two numbers using switch statement
C program to check whether a character is vowel or consonant using switch statement
C program to find maximum of three numbers using conditional operator
C program to check decimal digit character using conditional operator
C program to print all factors of a number using for loop
C program to find product of digits of a number using while loop
C program to find all roots of quadratic equation
C program to count number of digits in an integer
C program to check a number is palindrome or not
List of all C programs