C Program to Check Whether a Given Year is Leap Year or Not

#include<stdio.h>
#include<conio.h>

void main()
{
	 int y;
	 clrscr();
	 printf("Enter year: ");
	 scanf("%d", &y);
	 if( (y%400 == 0) || (y%4 == 0 && y%100 != 0) )
	 {
	  printf("%d is a leap year.", y);
	 }
	 else
	 {
	  printf("%d is not a leap year.", y);
	 }
	 getch();
}

Output

Run 1:
----------------
Enter year: 3000 ↲
3000 is not a leap year.

Run 2:
----------------
Enter year: 2004 ↲
2004 is not a leap year.

Leave a Reply

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

https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
About
Products
Subscribe

If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

    Applauz

    As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

    Subscribe

    If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

      Applauz

      As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

      Copyright by BOLD THEMES. All rights reserved.