Problem C: 判断闰年

Problem C: 判断闰年

Time Limit: 1 Sec   Memory Limit: 2 MB
Submit: 16371   Solved: 8056
[ Submit][ Status][ Web Board]

Description

输入一个正整数的年份,判断是否为闰年。

Input

输入只有一行,为一个10000以内的正整数。

Output

输出为一行。
若输入为闰年则输出“Yes”,否则输出“No”。

Sample Input

2010

Sample Output

No

HINT

了解逻辑运算符和关系运算符。

Append Code

#include <stdio.h>
#include <stdlib.h>
 
int main()
{
     int x;
     scanf ( "%d" ,&x);
     if (x%4==0&&x%100!=0) printf ( "Yes\n" );
     else if (x%400==0) printf ( "Yes\n" );
     else printf ( "No\n" );
     return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_41983901/article/details/80070139