Leap year program in C
Write a C program to check the leap year or not.
#include<stdio.h>
#include<conio.h>
void main()
{
int year;
printf("enter a year");
scanf("%d",&year);
if(year%400==0)
{
printf("%d enter year is leap year",year);
}
else if(year%100==0)
{
printf("%d enter year is leap year",year);
}
else if(year%4==0)
{
printf("%d enter year is leap year",year);
}
else
{
printf("%d enter year is not a leap year",year);
}
getch();
}
No comments:
Post a Comment