C Program to accept a year and check whether the given year is leap year or not

#include<stdio.h>
#include<conio.h>
main( )
{
int x;
clrscr( );
printf("\n\tEnter a year:");
scanf("%d",&x);
if(x%4==0 && x%100!=0|| x%400==0)
printf("\n\tThe above given year IS a leap year");
else
printf("\n\tThe above given year IS not a leap year");
getch();
}

Output:
Run-1

Run-2

No comments:

Post a Comment

100 C Programs with Code and Output

Program 1: C Program To Read Two Numbers And Print The Sum Of Given Two Numbers. Program 2: C Program To Read Three Numbers And Prin...