SCHOOL OF CODE BUILDERS
Learn To CODE. Become A DEVELOPER.
Pages
HOME
DATA STRUCTURES
STRINGS
ARRAYS
MATRIX
BINARY TREES
LINKED LIST
STACK
QUEUE
SORTING
SEARCHING
C
PYTHON
PSEUDOCODE
CONTEST PROBLEMS
ALGORITHMS
PATTERNS
PHP
C PUZZLES
C INTERVIEW QUESTIONS
JAVA
C++
HASHING
RECURSION
BASIC C PROGRAMS
TCS-CODEVITA
FACEBOOK
CONTACT US
Display month name according to the month number using switch case statement.
Display month name according to the month number using switch case statement.
Input:
Enter the month (1-12): 5
Output:
Month is May
Implementation:
#include
int main(void) { int month; printf("Enter the month (1-12):\n"); scanf("%d",&month); switch(month) { 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("Enter a valid input (1-12)"); break; } return 0; }
PREVIOUS
NEXT
HOME