C Program To Know No of days in a Given Month

#include<stdio.h>
#include<conio.h>
main()
{
int month;
printf("Enter month number (1-12) to know the no.of days: ");
scanf("%d",&month);
switch(month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12: printf("...%d month has 31 days...",month);
  break;
case 2:printf("...%d month has 28 days (29 if it is leap year)");
 break;
case 4:
case 6:
case 9:
case 11: printf("...%d month has 30 days...",month);
 break;
default: printf("Sorry...!! Wrong option entered...");
}
getch();
}
Bhanu Namikaze

Bhanu Namikaze is an Ethical Hacker, Web Developer, Student and Mechanical Engineer. He Enjoys writing articles, Blogging, Solving Errors and Social Networking. Feel Free to let me know any of your concerns about hacking or let me know if you need any more methods on hacking anything. Enjoy Learning

No comments:

Post a Comment