QUESTION:- program to display the name and days of the month by entering the number 1-12 of the month
#include <stdio.h>
#include <conio.h>
int main()
{
int a;
printf("select a number!");
printf("1. \n");
printf("2. \n");
printf("3. \n");
printf("4. \n");
printf("5. \n");
printf("6. \n");
printf("7. \n");
printf("8. \n");
printf("9. \n");
printf("10. \n");
printf("11 \n");
printf("12.\n");
scanf("%d", &a);
if (a == 1)
{
printf("January - 31 days!");
}
else if (a == 2)
{
printf("February - 28 days in a common year!");
}
else if (a == 3)
{
printf("March - 31 days!");
}
else if (a == 4)
{
printf("April - 30 days!");
}
else if (a == 5)
{
printf("May - 31 days!");
}
else if (a == 6)
{
printf("June - 30 days!");
}
else if (a == 7)
{
printf("July - 31 days!");
}
else if (a == 8)
{
printf("August - 31 days!");
}
else if (a == 9)
{
printf("September - 30 days!");
}
else if (a == 10)
{
printf("October - 31 days!");
}
else if (a == 11)
{
printf("November - 30 days!");
}
else if (a == 12)
{
printf("December - 31 days!");
}
else
{
printf("enter a correct number!");
}
getch();
return 0;
}
OUTPUT
select a number!
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11
12.
4
April - 30 days!
0 Comments