Problem C: Determining leap years

Problem C: Determining leap years

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

Description

Enter a positive integer year to determine whether it is a leap year.

Input

The input has only one line, which is a positive integer within 10000.

Output

The output is one line.
Output "Yes" if the input is a leap year, otherwise output "No".

Sample Input

2010

Sample Output

No

HINT

Learn about logical and relational operators.

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;
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324787625&siteId=291194637