输入一个年份,判断是闰年还是平年并输出。(用if选择结构)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int year;
cin >> year;
if ((year % 100 != 0 && year % 4 == 0) || (year % 400 == 0))
cout << "闰年";
else
cout << "平年";
return 0;
}
if(year%4==0||year%400==0)
{
if(year%100!=0)
printf("闰年");
else
printf("平年");
}