HTML Tutorial || Networking Assignment || Computer Full Forms || Ms-Office Shortcut Keys || Ms-Office Notes || Number System Notes || Internet Assignment
JavaScript Tutorial || CSS Tutorial || Operating System Notes || History of Computer Assignment || Netwoking Notes || Computer Fundamentals Notes

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