Header Ads

Find Month in c program

Find Month in c program

#include <stdio.h>
int main() {
int num;
scanf("%d",&num);
switch(num)
{
    case 1:
    printf("The entered month is JANUARY\n");
    printf("It has 31 days");
    break;
    case 2:
    printf("The entered month is FEBRAURY\n");
     printf("It has 28 days");
     break;
    case 3:
    printf("The entered month is MARCH\n");
    printf("It has 31 days");
    break;
    case 4:
    printf("The entered month is APRIL\n");
     printf("It has 30 days");
     break;
    case 5:
    printf("The entered month is MAY\n");
     printf("It has 31 days");
     break;
    case 6:
    printf("The entered month is JUNE\n");
     printf("It has 30 days");
     break;
    case 7:
    printf("The entered month is JULY\n");
     printf("It has 31 days");
     break;
    case 8:
    printf("The entered month is AUGUST\n");
     printf("It has 31 days");
     break;
    case 9:
    printf("The entered month is SEPTEMBER\n");
     printf("It has 30 days");
     break;
    case 10:
    printf("The entered month is OCTOBER\n");
     printf("It has 31 days");
     break;
    case 11:
    printf("The entered month is NOVEMBER\n");
     printf("It has 30 days");
     break;
    case 12:
    printf("The entered month is DECEMBER\n");
     printf("It has 31 days");
     break;
     default:
     printf("Not found");
     }
    return 0;
}


Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Powered by Blogger.