Toph easy problem(Leap Years)

Question:

Leap Years

Limits: 1s, 512 MB

In the Gregorian calendar, certain years have 366 days instead of 365. In such years, the month of February is extended to have 29 days (instead of 28 days). These years are known as leap years.
A leap year occurs when the year is a multiple of 4 but not a multiple of 400.
Given a year, determine if the year is a leap year.

Input

The input will contain a one integer Y (0 < Y < 9999).

Output

Print “Yes” if the year is a leap year, otherwise “No”.

Samples

InputOutput
2004

Solve in C:

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



Yes

No comments

Most View Post

Recent post

RESTful APIs with CRUD Operations in Laravel 12| (2025)

  RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

Powered by Blogger.