Program to find Days in a week by entering a number using switch statement in C language (Program 09)

 /*Made by Anmol main

Student B.tech CSE

Punjabi university

Hindustan Coding

Program 09*/


#include<stdio.h>

int main()

{   int a; //write the fixed values of a and b if not then take it from the user

    printf("Enter number of day\n");

    scanf("%d",&a);


    if (a>7||a==0)

        printf("There are only 7 days in a week\nso please enter 1 to 7 digit\n");

    else {

        switch (a)

        {

        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;

        }



    }

    return 0;

}

Comments

Popular posts from this blog

Glowing-Log-in-window-in-Pure-html-css #30

Program to swap 2 numbers by using 3 numbers, taking input from user in C language. #1

C program to print lengh of an array (program 20)