Thursday , 17 April 2014
Home » Tutorials » C programming » C Program to Find if a year is Leap Year or not

C Program to Find if a year is Leap Year or not


Program:

#include <stdio.h>

 
main()
{
      int year;
      clrscr();

      printf("Enter a year to check if it is a leap year\n");
      scanf("%d", &year);

      if ( year%400 == 0)
         printf("%d is a leap year.\n", year);
      else if ( year%100 == 0)
         printf("%d is not a leap year.\n", year);
      else if ( year%4 == 0 )
         printf("%d is a leap year.\n", year);
      else
         printf("%d is not a leap year.\n", year);   
      getch();
      return 0;
}

About Rajeel

I think you all are familier with me. hmm... You may be or not, let me tell. I'm Rajeel, a teen blogger from India who loves computers, sports, internet and all other kind of tech stuffs. I love to call myself as the 'TeeN GeeK' Find me in G+

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv badge

Scroll To Top