C Program for Leap Year

Before realizing the C program for leap year gives initial a chance to comprehend what precisely is a leap year.

What is a Leap Year?

In a typical year, there are 365 days while in a leap year there are 366 days. Here the additional day is the 29th Feb.

How to Check Year is a Leap Year or not?

In the event that the year is totally distinct by 4, at that point it is a leap year. For instance 2016, 2020, and so on.

It the year is century year (finishing with 00) at that point it ought to be distinguishable by 400, at exactly that point it will be a leap year. For instance 2000, 2004, and so on.

C Program for Leap Year

Presently let’s view its execution in C language.

#include<stdio.h>
 
void main()
{
    int year;
    
    printf("Enter any year(4-digit):");
    scanf("%d",&year);
    
    if(year%100==0)
    {
        if(year%400==0)
            printf("\nLeap Year");
        else
             printf("\nNot Leap Year");
    }
    else
        if(year%4==0)
            printf("\nLeap Year");
        else
            printf("\nNot Leap Year");
}

Output

Enter any year(4-digit):2020
Leap Year

DURGESH

I Love python, so I like machine learning a Lot and on the other hand, I like building apps and fun games I post blogs on my website for Tech enthusiast to learn and Share Information With The World.

Leave a Reply

Your email address will not be published. Required fields are marked *

7 − seven =

Recent Content