Any year is input through the keyboard. Write a program to determine whether the year is a leap year or not.

#include<stdio.h>
void main()
{
	int year;
	printf("\nEnter year=");
	scanf("%d",&year);
	if(year%100==0)
	{
	    if(year%400==0)
	    printf("\nIt is a leap year");
	    else
	    printf("\nIt is not a leap year");
	}
	else
	{
	    if(year%4==0)
	    printf("\nIt is a leap year");	
	    else
	    printf("\nIt is not a leap year");
	}
}

The output will be

Post a Comment (0)
Previous Post Next Post