#include<stdio.h>
#include<conio.h>
void main()
{
int month_no;
printf("Enter the month number (1-12): ");
scanf("%d",&month_no);
if(month_no==1)
printf("\nJanuary");
else if(month_no==2)
printf("\nFebruary");
else if(month_no==3)
printf("\nMarch");
else if(month_no==4)
printf("\nApril");
else if(month_no==5)
printf("\nMay");
else if(month_no==6)
printf("\nJune");
else if(month_no==7)
printf("\nJuly");
else if(month_no==8)
printf("\nAugust");
else if(month_no==9)
printf("\nSeptember");
else if(month_no==10)
printf("\nOctober");
else if(month_no==11)
printf("\nNovember");
else if(month_no==12)
printf("\nDecember");
else
printf("\nPlease enter a valid month number between 1 and 12");
getch();
}
Output:
#include<conio.h>
void main()
{
int month_no;
printf("Enter the month number (1-12): ");
scanf("%d",&month_no);
if(month_no==1)
printf("\nJanuary");
else if(month_no==2)
printf("\nFebruary");
else if(month_no==3)
printf("\nMarch");
else if(month_no==4)
printf("\nApril");
else if(month_no==5)
printf("\nMay");
else if(month_no==6)
printf("\nJune");
else if(month_no==7)
printf("\nJuly");
else if(month_no==8)
printf("\nAugust");
else if(month_no==9)
printf("\nSeptember");
else if(month_no==10)
printf("\nOctober");
else if(month_no==11)
printf("\nNovember");
else if(month_no==12)
printf("\nDecember");
else
printf("\nPlease enter a valid month number between 1 and 12");
getch();
}
Output:
Please have a look at the below lesson posted on my YouTube channel:
No comments:
Post a Comment