D017: print the number of days in a month.

Source: Internet
Author: User

D017: print the number of days in a month.

Content:

Print the number of days in a month.

Input description:

Two integers in one row, followed by the year and followed by the month

Output description:

An integer

Input example:

If the questions are not described in detail, read them in multiple groups of test data, or refer to a001.
2009 6

 

Output example:

30

Tip: Pay attention to the definition of the leap year and the number of days in February

 

Source:

(Administrator: Problem)

Answer: # Include <iostream> <br/> # include <iomanip> <br/> using namespace STD; <br/> int main () <br/>{< br/> int year, month, day; <br/> CIN> year> month; <br/> If (Year % 4 = 0) & (Year % 100! = 0) | (Year % 400 = 0) <br/>{< br/> switch (month) <br/>{< br/> case 1: cout <"31" <Endl; break; <br/> case 2: cout <"29" <Endl; break; <br/> case 3: cout <"31" <Endl; break; <br/> case 4: cout <"30" <Endl; break; <br/> case 5: cout <"31" <Endl; break; <br/> case 6: cout <"30" <Endl; break; <br/> case 7: cout <"31" <Endl; break; <br/> case 8: cout <"31" <Endl; break; <br/> case 9: cout <"30" <Endl; break; <br/> case 10: cout <"31" <Endl; break; <br/> case 11: cout <"30" <Endl; break; <br/> case 12: cout <"31" <Endl; break; <br/>}< br/> else <br/> {<br/> switch (month) <br/>{< br/> case 1: cout <"31" <Endl; break; <br/> case 2: cout <"28" <Endl; break; <br/> case 3: cout <"31" <Endl; break; <br/> case 4: cout <"30" <Endl; break; <br/> case 5: cout <"31" <Endl; break; <br/> case 6: cout <"30" <Endl; break; <br/> case 7: cout <"31" <Endl; break; <br/> case 8: cout <"31" <Endl; break; <br/> case 9: cout <"30" <Endl; break; <br/> case 10: cout <"31" <Endl; break; <br/> case 11: cout <"30" <Endl; break; <br/> case 12: cout <"31" <Endl; break; <br/>}< br/> return 0; <br/>}

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.