Check for Leap Year using C

 

Leap year is a year which there are  366 days.

February has 29 days in a leap year 28 other wise. The leap year occurs when the year is divisible by 400 or year is divisible by 4 & not divisible by 100.

#include<stdio.h>
#include<conio.h>
void main ()
{
int year;
clrscr();
printf(“enter a year to get the year category\n”);
scanf(“%d”,&year);
if(year % 400==0)
printf(“leap year”);
else
if(year % 4==0 && year % 100!=0)
printf(“leap year”);
else
printf(“not a leap year”);
getch();

After running the program –

Leave a Reply