Wuhan University of Science and Technology acm:1002:0 starting point algorithm 28--judging whether leap year

Source: Internet
Author: User

Problem Description

Enter the year to determine if the leap years

Input

Enter an integer n (multiple sets of data)

Output

If it is a leap year, output Yes, otherwise output no (one row per group of data)

Sample Input
2000
Sample Output
Yes
My Code:

1#include <stdio.h>2 intMain ()3 {    4    intYear ;5      while(SCANF ("%d", &year)! =EOF)6     {7 8         if((year%4==0&& year% -!=0) || (year% -==0) ) 9         {Tenprintf"yes\n"); One         }             A         Else -         { -printf"no\n"); the         } -     } -     return 0; -}

Other code:

1#include <iostream>2 3 using namespacestd;4 5 intMain ()6 {7     intYear ;8      while(cin>>Year )9     {Ten         if((year%4==0) && (year% -!=0)  || (year% -==0)  ) One          { Acout<<"Yes"<<Endl; -  -          } the         Else -         { -cout<<"No"<<Endl; -         } +  -     } +     return 0; A}

Wuhan University of Science and Technology acm:1002:0 starting point algorithm 28--judging whether leap year

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.