counter

Free Hit Counter

C program to check if input year is leap year

Q:C program to check if input year is leap year or not when the year is input from the user

#include
#include
void main()
{
int year;
clrscr();
printf("enter any year: ");
scanf("%d",year);
if(year%400==0 || year%100!=0 && year%4==0)
{
printf("this year is leap year");
}
else
{
printf("this year is not leap year");
}
getch();
}

No comments:

Post a Comment