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.

See this code in :


C++

Java

Also see :


PROGRAM TO SWAP TWO NUMBERS USING XOR OPERATION

PROGRAM TO SWAP TWO NUMBERS USING THIRD VARIABLE

PROGRAM TO FIND THE REVERSE OF A NUMBER

PROGRAM TO FIND THE GREATEST NUMBER AMONG THREE NUMBERS

PROGRAM TO EVALUATE THE SUM OF FIRST 'N' NUMBERS

PROGRAM TO GENERATE THE SUM OF ALL DIGITS OF A NUMBER

Participate in our MONTHLY CHALLENGE,and get a chance to get listed on our site and win the TITLE of "MR.GEEK".


RUSH TO OUR MONTHLY CHALLENGE

Join us :



CODE OF GEEKS

A Platform to LEARN | CODE | ACHIEVE

Connect :



INTERESTING READ FOR YOU :

TOP PROGRAMMING LANGUAGES THAT ARE RULING IN 2018.
TOP PROGRAMMING LANGUAGES FOR WEB DEVELOPMENT IN 2018.

SHARE:



For any Queries,suggestions,feel free to Mail us at :
[email protected]

For reporting any kind of copyright voilation,mail us at : [email protected]

© copyright CODE OF GEEKS 2018