C Language Programming Case Tutorial (second edition) answer

Source: Internet
Author: User

I plan to graduate school: The University of Beijing University of Technology-computer

Course Number 985: Textbook for C language programming case tutorials and Min data structure that book

Now begin to review the C language, plan to write the following part of the code to write the title once

Not regularly with the new one week later


======================== the second chapter &NBSP;C the basic control structure of the language ========================//==========4. Enter a year from the keyboard to determine whether the year is a leap years//====== ====5. Enter a year and month from the keyboard, and the number of days to output this month//========== simpler #include<stdio.h>//the days of the month Int daynum (Int year,  int mouth) {int flag = 0;if ( year % 100 != 0 & & year % 4 == 0 )  | |   ( year % 400 == 0)) flag = 1; //  Leap Month if (mouth == 1  | |  mouth == 3 | |  mouth == 5 | |  mouth == 7 | |  mouth == 8 | |  mouth == 10 | | &NBSP;MOUTH&NBSP;==&NBSP;12) return 31;else if (Mouth == 2 && flag) return  29;else if (Mouth == 2 && !flag) return 28;elsereturn 30;} Int main () {int year,mouth;scanf ("Enter any year:");while  (scanf ("%d%d", &year,&mouth)  == &NBSP;2) {if (year >= 0 && mouth > 0 && mouth <= &NBSP;12) {if ( year % 100 != 0 && year % 4 == 0  )  | |   ( year % 400 == 0)  ) printf ("%d is leap month \ t days are%d\n", Year,daynum (Year,mouth)); elseprintf ("%d is not leap month \ t days is%d\n", Year,daynum (Year,mouth));} elseprintf ("Hyper-range, re-enter \ n");} return 0;}



This article is from the "Rise" blog, please be sure to keep this source http://20111564.blog.51cto.com/6048168/1564609

C Language Programming Case Tutorial (second edition) answer

Related Article

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.