C Program To Read Month Number And Display Month Name Using Switch Case

In this article, we are going to write a C Program To Read Month Number And Display Month Name Using Switch Case.

To make this program, we will use the following concept -:

If you do not know about these topics well, then you may not understand this program, so you should know about them in detail from the link given above.

Now without wasting time let’s start programming.

Write a C Program To Read Month Number And Display Month Name Using Switch Case

Algorithm

  1. Program Start
  2. Declaration of variable
  3. Enter month number
  4. Assign the value in variable
  5. Pass number in switch() case
  6. Give answer according to value
  7. Program Stop

Flowchart

C Program To Read Month Number And Display Month Name Using Switch Case

Program

//Write a C Program To Read Month Number And Display Month Name Using Switch Case

#include<stdio.h>

void main()
{
    int choise;
    printf("\n enter the month number : ");
    scanf("%d",&choise);
    switch(choise)
    {
        case 1: printf("Month is :  January");
                break;
        case 2: printf("Month is :  February");
                break;
        case 3: printf("Month is :  March");
                break;
        case 4: printf("Month is :  April");
                break;
        case 5: printf("Month is :  May");
                break;
        case 6: printf("Month is :  June");
                break;
        case 7: printf("Month is :  July");
                break;
        case 8: printf("Month is :  August");
                break;
        case 9: printf("Month is :  September");
                break;
        case 10: printf("Month is :  October");
                break;
        case 11: printf("Month is :  November");
                break;
        case 12: printf("Month is :  December");
                break;
        default : printf("invalid number");
    }


}

Output

Enter the  month number : 5
Month is : May

Conclusion

In this article, we have created all the following programs -:

  • Write a C Program To Read Month Number And Display Month Name Using Switch Case

If you have difficulty to understand any program or have any doubts or questions, then tell me in the comment below.

Jeetu Sahu is A Web Developer | Computer Engineer | Passionate about Coding, Competitive Programming, and Blogging

Leave a Comment