閏年的判斷方法
①、非整百年能被4整除的爲閏年。(如2004年就是閏年,2100年不是閏年)
②、能被400整除的是閏年。(如2000年是閏年,1900年不是閏年)
#include<iostream>
using namespace std;
bool leapyear(int n)
{
return(n%4==0&&n%100||n%400==0);
}
int main()
{
int n;
while(cin>>n)
{
if(leapyear(n))
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}
return 0;
}