闰年判断

Problem Description

输入年份,判断是否闰年

Input

输入一个整数n(多组数据)

Output

如果是闰年,输出yes,否则输出no(每组数据一行)

Sample Input

2000

Sample Output

yes





#include <iostream>

using namespace std;

int main()
{
    int year;
    while(cin>>year)
    {
        if( (year%4==0)&&(year%100!=0)  || (year%400==0)  )
         {
            cout<<"yes"<<endl;

         }
        else
        {
            cout<<"no"<<endl;
        }

    }
    return 0;
}


原文地址:https://www.cnblogs.com/yldf/p/6249939.html