Check given year is a Leap year or not ( Chapter 2 Program 4 )
Also visit our YouTube Channel Tech Eos VISIT CHANNEL
/* 4. Write a program to check given year is a Leap year or not. */
#include<stdio.h>
#include<conio.h>
void main()
{
int year;
clrscr();
printf("Enter year : ");
scanf("%d" , &year );
if( year %4 ==0 )
{
if( year %100 == 0 )
{
if(year %400 ==0 )
{
printf("\n\n%d is an leap year" , year);
}
else
{
printf("\n\n%d is not an leap year" , year);
}
}
else
{
printf("\n\n%d is an leap year" , year);
}
}
else
{
printf("%d is not an leap year" , year );
}
getch();
}
Comments
Post a Comment