leap year program in c | Condition | Using Operators 

Leap year Program in C


To find a Year is leap or not is not a tricky Program. The simple program that we can understand leap year program in c. Before understanding a leap year Program in c language, you have to must know what is a leap year, how we can find, what are the conditions a year met to consider that is a leap year. That concept is not much hard that you think, because Now you are going to know concept of the leap year and it's program in c.


Generally, when it comes to a year is leap or not ? Most of you assume that the number of the year is evenly divisible by 4 is also known as a leap year. So, in this case most of people sit infront pc or laptop and write their program of leap year in c, where they get result is correct but in some cases their result becomes wrong. So, a year is divisible by 4 is not only the case. 

  • If the year is leap, it is devisable 100
  • If the year divisible 100, it also be divisible by 400
  • Except this, A year is divisible by 4 is also a leap year. 

Leap Year Program in C

#include <stdio.h>

int main()
{
int year;

printf("Enter Any Year : ");
scanf("%d", &year);

if (year % 4 == 0)
{
if (year % 100 == 0)
{
if (year % 400 == 0)
printf("The Year %d is a Leap Year.", year);
else
printf("The year %d is not a Leap Year", year);
}
else
printf("The year %d is a Leap Year.", year);
}

else
printf("The year %d is not a Leap Year.", year);

return 0;
}



Post a Comment

Previous Post Next Post