‘C’ program to check given year is leap year or not.
C File =>
/* Write a ‘C’ program to check whether the given year is leap year or not. */
#include<stdio.h>
int main()
{
int year;
printf("Enter year: ");
scanf("%d",&year);
if(year % 4 == 0)
{
//Nested if else
if( year % 100 == 0)
{
if ( year % 400 == 0)
printf("\n%d is a Leap Year", year);
else
printf("\n%d is not a Leap Year", year);
}
else
printf("\n%d is a Leap Year", year );
}
else
printf("\n%d is not a Leap Year", year);
return 0;
}
Comments
Post a Comment
Please do not enter any spam link in message.