Tech Study

Write C program to print day of week name using switch case

Introduction

Write C program to print day of week name using switch case

#include <stdio.h>
int main()
{
    int weeknumber;

    //Reading week no from user
    printf("Enter week number(1-7): ");
    scanf("%d", &weeknumber);

    switch(weeknumber)
    {
        case 1: printf("Monday");
            break;
        case 2: printf("Tuesday");
            break;
        case 3: printf("Wednesday");
            break;
        case 4: printf("Thursday");
            break;
        case 5: printf("Friday");
            break;
        case 6: printf("Saturday");
            break;
        case 7: printf("Sunday");
            break;
        default: printf("Invalid input! Please enter week no. between 1-7.");
    }
    return 0;
}

Result

Write C program to print day of week name using switch case
Write C program to print day of week name using switch case

TaggedWrite C program to print day of week name using switch case

Python Examples

Introduction: Python Examples are the basic programming concepts of python like python syntax,python data types,,python operators,python if else,python comments etc.. …

Read more

C String Functions

C String Functions perform certain operations, It provides many useful string functions which can come into action. The <string.h> header …

Read more