C program to Input a Month Number and Print Number of Days in that Month ?
Q:- Write a C program to Input a Month Number and Print Number of Days
in that
Month ?
input
#include<stdio.h>
#include<conio.h>
int main()
{
int month;
clrscr();
printf(“Enter Month Number(1-12) = “);
scanf(“%d”,&month);
if(month == 1)
{
printf(“);
{
printf(“31 Days.”);
}
else if(month == 2)
{
printf(“28/29 Days.”);
}
else if(month == 3)
{
printf(“31 Days.”);
}
else if(month == 4)
{
printf(“30 Days.”);
}
else if(month == 5)
{
printf(“31 Days.”);
}
else if(month == 6)
{
printf(“30 Days.”);
}
else if(month == 7)
{
printf(“31 Days.”);
}
else if(month == 8)
{
printf(“31 Days.”);
}
else if(month == 9)
{
printf(“30 Days.”);
}
else if(month == 10)
{
printf(“31 Days.”);
}
else if(month == 11)
{
printf(“30 Days.”);
}
else if(month == 12)
{
printf(“31 Days.”);
}
else
{
printf(“Invalid Input!!!!!!”);
}
getch();
}
Output
Enter a
Month Number (1-12) = 12
31 Days.
Comments
Post a Comment