Created
April 29, 2021 08:20
-
-
Save btechmag/3467503f21e8959b309bbd97688a941e to your computer and use it in GitHub Desktop.
C Program that reads an integer between 1 and 12 and prints the month of the year.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
//Program that reads an integer between 1 and 12 and prints the month of the year | |
int month; | |
printf("Input a number between 1 - 12:"); | |
scanf("%d", &month); | |
switch(month) | |
{ | |
case 1: printf("January\n");break; | |
case 2: printf("February\n"); break; | |
case 3: printf("March\n"); break; | |
case 4: printf("April\n"); break; | |
case 5: printf("May\n"); break; | |
case 6: printf("June\n"); break; | |
case 7: printf("July\n"); break; | |
case 8: printf("August\n"); break; | |
case 9: printf("September\n"); break; | |
case 10: printf("October\n"); break; | |
case 11: printf("November\n"); break; | |
case 12: printf("December\n"); break; | |
default: printf("There does not exist any month"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment