1010 Example 2-3 judging leap year

Source: Internet
Author: User
The title Description enters an arbitrary year between 2000-2,500 years (including 2000 and 2500) and determines whether it is a leap year. enter An integer year that represents the years. Enter the guaranteed 2000≤year≤2500. output If the year entered is a leap years, output "leap yearly", otherwise output "not leap year".
Note that output quotation marks are not required and line endings are output wrapped. Sample Input
2000
Sample output
Leap year


#include <stdio.h>
int main ()
{
int year,leap;
scanf ("%d", &year);
if (year%4==0)
{
if (year%100==0)
{
if (year%400==0)
leap=1;
else leap=0;
}
else leap=1;
}
else
leap=0;
if (LEAP)
printf ("Leap year\n");
else printf ("Not leap year\n");
return 0;
}



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.