Check whether the enter year is leap or not



 #include <stdio.h>

#include<conio.h>

int main()

{

int yr;

  printf ("Enter a year \n");

  scanf ("%d",&yr);


  if (yr%4 == 0) {


      if(yr%100 == 0) {

      

          if(yr%400 == 0)

             printf(" It is LEAP YEAR.");

          else

             printf(" It is NOT LEAP YEAR.");

      }


      else {

             printf (" It is LEAP YEAR.");

      }

  }

  else

      printf(" It is NOT LEAP YEAR.");

  return 0;

}



Output:-

Enter a year 2004

It is LEAP YEAR


Enter a year 2003

It is NOT LEAP YEAR

Comments

Popular posts from this blog

Check whether the no entered is Palindrome or not

Addition, Subtraction, Multiplication and Division with Function

Calculate Factorial of a given no with help of Recursion