Skip to content

p024.c

Problem Statement

WAP to check whether a year is leapyear or not.

Metadata

Property Detail
Author Amit Dutta (amitdutta4255@gmail.com)
License MIT

Actions

Raw View on GitHub

💡 You can print or save this file by opening Raw and using your browser.

Source Code

#include <stdio.h>
int main()
{
    int year;
    printf("Enter the year : ");
    scanf("%d", &year);
    if (year % 4 == 0 && year % 100 != 0)
        printf("\nYear %d is a leapyear.", year);
    else if (year % 400 == 0)
        printf("\nYear %d is a leapyear (Century).", year);
    else
        printf("\nYear %d is not a leapyear.", year);
    return 0;
}