1160C language Experiment--the number of days in a certain year

Source: Internet
Author: User


Topic Description Enter the year and month, and determine how many days of the month. enter the year and month, in the form of year \ Month. output The number of days of the month. Sample Input

2009\1
Sample Output
31


#include <stdio.h> void Main ()
{
int year,yue;
scanf ("%d\\%d", &year,&yue);
Switch (Yue)
{
 case 1:printf ("31\n");
   case 2:
 if ((year%4==0) && (year%100!=0) | | (year%400==0)) printf ("29\n");
Else printf ("28\n");
      case 3:printf ("31\n");
      case 4:printf ("30\n");
 case 5:printf ("31\n");
      case 6:printf ("30\n");
      case 7:printf ("31\n");
      case 8:printf ("31\n");
      case 9:printf ("30\n");
      case 10:printf ("31\n");
      case 11:printf ("30\n");
      case 12:printf ("31\n");
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.