leap-year-or-not

Leap year: If a year is divisible by 4 and the remainder is 0 then it is a leap year, except for century years.
Century years are those, which ends with 00. A century year is a leap year only if it is perfectly divisible by 400.

For example:

2011: Not a leap year. Because it is not divisible by 4.
2012: Leap year. Because it is perfectly divisible by 4.

Rectangular shaped pattern with letters – C Program

Hello World – My first C Program

Hollow rectangular shaped star pattern – C Program

2000: Leap year. A century year and it is perfectly divisible by 400.
1900: Not a leap year. A century year which is not divisible by 400.
Logic
Leap year:
A year should not be divisible by 100 and should be divisible by 4.
A year which is a century year should be divisible by 400.
else
The year is not leap year.

OUTPUT
Leap year or not – C program
Tagged on:

One thought on “Leap year or not – C program

  • December 25, 2015 at 7:38 pm
    Permalink

    Awesome explanation buddy.I am a beginner. Thanks 🙂

    Reply

Leave a Reply

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