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.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#include<stdio.h> #include<conio.h> int main( ) { int y; printf("Enter a year: "); scanf("%d",&y); if(y%4==0 && y%100!=0 || y%400==0) printf("%d is a leap year.",y); else printf(""%d is not a leap year.",y); getch(); return 0; } |

**OUTPUT**

1 2 3 4 5 |
Enter a year: 1900 1900 is not a leap year. Enter a year: 2016 2016 is a leap year. |

Awesome explanation buddy.I am a beginner. Thanks ðŸ™‚