New Android apps UniqueKey

Saturday 7 March 2015

Check whether year is a leap year or not


/*program to check the year leap or not*/

#include<stdio.h>
#include<math.h>

main()
{
  int year;
 
  printf("enter the year which you want to check\n");
  scanf("%d",&year);

  if(year%400==0)
   {
       printf("%d is leap year\n",year);
   }  
  else
   { 
     if(year%4==0&&year%100!=0)
     {
       printf("%d is leap year\n",year);
     }
     else
     {
       printf("%d is not leap year\n",year);
     }
   }  
}

No comments:

Post a Comment