CODE OF GEEKS


A PLATFORM TO LEARN | CODE | ACHIEVE


" Programming is the real test of your creativity,its all about how you turn ideas into codes. "



Connect :


THIS WEBSITE IS BEST VIEWED IN THE GOOGLE CHROME WEB BROWSER.



TO CHECK WHETHER A ENTERED YEAR IS LEAP YEAR OR NOT IN C

Code

#include<stdio.h>
#include<conio.h>
int main() 
{
int year;
printf("ENTER THE YEAR :");
scanf("%d",&year);
if(((year % 4 == 0)&&(year % 100!= 0))||(year%400 == 0))
{
 printf("%d is a leap year", year);
}
else
{
 printf("%d is not a leap year", year);
}
return 0;
}

Output


ENTER THE YEAR :2000
2000 is a leap year


What we did - Our Approach


In this problem we have to determine whether a year is leap year or not.A leap year (also known as an intercalary year or bissextile year) is a calendar year containing one additional day (or, in the case of lunisolar calendars, a month) added to keep the calendar year synchronized with the astronomical or seasonal year.[1] Because seasons and astronomical events do not repeat in a whole number of days, calendars that have the same number of days in each year drift over time with respect to the event that the year is supposed to track. By inserting (also called intercalating) an additional day or month into the year, the drift can be corrected. A year that is not a leap year is called a common year. To check whether a year is a leap year or not,we rely on two conditions :
1.Year should be divisible by 4 and not divisible by 100.
2.Year should be divisible by 400.

Join us :



CODE OF GEEKS

A Platform to LEARN | CODE | ACHIEVE

Connect :



INTERESTING READ FOR YOU :

SHARE:



For any Queries,suggestions,feel free to Mail us at :
codeofgeeks@gmail.com

For reporting any kind of copyright voilation,mail us at : cogcopyclaim@gmail.com

© copyright CODE OF GEEKS 2018