MONTHS

Description:

Write a C program that accepts an integer as input and displays the corresponding month in words. [ January, February, March, April, May, June, July, August, September, October, November, December]. Use Switch statement. Input Format: Input consists of a single integer. Output Format: Refer sample output for details. Sample Input 1: 3 Sample Output 1: March Sample Input 2: 55 Sample Output 2: Invalid month

Program :

#include<stdio.h>
int main(){
  int n;
  scanf("%d\n",&n);
  switch (n)
  {
    case 1:
          printf("January\n");
        break;
    case 2:
          printf("February");
        break;
    case 3: 
          printf("March");
          break;
    case 4: 
          printf("April");
          break;
    case 5:
          printf("May");
          break;
    case 6:
           printf("June");
    break;
    case 7:
    printf("July");
    break;
    case 8:
    printf("August");
    break;
    case 9:
    printf("September");
    break;
    case 10:
    printf("October");
    break;
    case 11:
    printf("November");
    break;
    case 12:
    printf("December");
    break;
    default:
    printf("Invalid month");
  }
  return 0;
}