Welcome

>>>Welcome to my "CODE BAZAR"
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others

Update ✔✔✔ Upcoming programming book (.pdf) "Programming Contest (data structures and algorithms) by Md. Mahbub Hasan & "Graph Algorithms" by Safayat Asraf "****** Date: 20 March, 2019****Hazrat Ali****

Sunday 30 October 2016

L. LeapYear
Problem link
https://algo.codemarshal.org/contests/diu-122-fl16-termwork/problems/L

Score: 1

CPU: 1s
Memory: 512MB

In general terms, a leap year is a year that is divisible by 4. However, if a year is divisible by 100, that is not a leap year. But there is another catch, if the year is divisible by 400, then it's a leap year.

Input

A single integer denoting the year.

Output

If the input is a leap year print YES. Else print NO

Samples

InputOutput
2015NO
InputOutput
2204YES


Solution

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

No comments:

Post a Comment