C language = To check if a year is a leap year or not
To check if a year is a leap year or not
#include<stdio.h>
void main()
{
int a;
char ch[10];
printf("enter a Year\n");
scanf("%d",&a);
if(a%100==0)
{
if(a%400==0)
{
printf("it is a leap year %d\n",a);
}
else
{
printf("it is not a leap year %d",a);
}
}
else {
if(a%4==0)
{
printf("it is a leap year %d\n",a);
}
else
{
printf("it is not a leap year %d",a);
}
}
}
Comments
Post a Comment