Radical Developers welcomes all the visitors to be a member of the team. Come join us. Its all about open-source concept. All Programs are written and tested in MacOS X, Unix, Linux and may not match with the outputs of Turbo C++ in Windows

Sunday, January 9, 2011

Any year is input through the keyboard. Write a program to determine whether the year is a leap year or not.


Source Code :

#include<stdio.h>
void main()
{
      int n;
      clrscr();
      printf("\nEnter a Year : ");
      scanf("%d",&n);
      if(n%100==0)
      {
            if(n%400==0)
                  printf("\nLeap Year");
      }
      else if(n%4==0)
            printf("\nLeap Year");
      else
            printf("\nNot Leap Year");
      getch();
}

Output :

Enter a Year : 2008

Leap Year

No comments:

Post a Comment