C language Calculation This is the first day of the year __c language

Source: Internet
Author: User
int day (int-year, int month, int day)
{
   int i;int days = 0;
   int months[12] = {31,0,31,30,31,30,31,31,30,31,30,31};
   Determine whether a year is a leap years to see if it satisfies one of the 2 conditions (which cannot be met at the same time) 
   if ((year% 400 = 0) | | (Year% 4 = 0) && (year% 100!= 0)) A multiple of 400 or divisible by 4 and not divisible by 
      months[1] =;
   else
      months[1] =;
   for (i = 1; i < month i++) days
      + + months[i];
   Days = day;
   return days;
}

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.