1. zimrukunuzzaman@gmail.com : Zim :
C program to read month number and display month name - E-Education BD
E-Education BD
  • Phone
  • 01518961012
  • Contact
  • eeducationbd21@gmail.com
  • Location
  • Gaibandha,Rangpur
  • C program to read month number and display month name
    To write this program we will use switch case. In this program, we will take as input an integer between 1 to 12 from the user and display the month corresponding to that integer. Read more about Check Vowel or Consonant in C Programming

    Let's start the program

    #include<stdio.h>
    int main()
    {
        int number;
        printf("Enter a month numbern");
        scanf("%d",&number);
        switch(number)
      {
        case 1:
        printf("nJanuary");break;
        case 2:
        printf("nFebruary");break;
    
        case 3:
        printf("nMarch");break;
        case 4:
        printf("nApril");break;
        case 5:
        printf("nMay");break;
        case 6:
        printf("nJune");break;
        case 7:
        printf("nJuly");break;
        case 8:
        printf("nAugust");break;
        case 9:
        printf("nSeptember");break;
        case 10:
        printf("nOctober");break;
        case 11:
        printf("nNovember");break;
        case 12:
        printf("nDecember");break;
    
        default:
            printf("No monthn");break;
    
            }
            getch();
            }
    
    Output
    Enter a month number
    5
    
    May