1-4-17: Judging leap years

Source: Internet
Author: User

Description Determines whether a year is a leap years. Input input is only one row, contains an integer a (0 < a < 3000) output line, if year A.D. is a leap years output y, otherwise output n sample input

2006

Sample output

N

It is suggested that the Gregorian calendar method, which can be divisible by 4 is mostly leap years, but can be divisible by 100 and not divisible by 400 is not a leap year, can be divisible by 3200 is not a leap, such as 1900 is common year, 2000 is leap year, 3200 is not a leap year.

1#include <stdio.h>2 intMain ()3 {4     intA;5scanf"%d",&a);6     if(a%4!=0)7printf"n\n");8     Else9         if(a% -!=0)Tenprintf"y\n"); One         Else A             if(a% -==0) -printf"y\n"); -             Else theprintf"n\n"); -     return 0; -}

1-4-17: Judging leap years

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.