Saturday , 1 November 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'm Rajeel, a teen blogger from India who loves computers, sports, internet and all other kind of tech stuffs. This blog thing is one of my favourite hobby and the one that eats up much of my time. But Really, I'm loving it :) 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