Solved

Get leap year

Posted on 1997-11-12
4
470 Views
Last Modified: 2008-03-06
How could compute for a given year if it is a leap year or not. ? consider the century years.
0
Comment
Question by:fvallejo
  • 2
4 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1256270
(year%4==0)^(year%100==0)^(year%400==0)
0
 
LVL 2

Accepted Solution

by:
wpinto earned 50 total points
ID: 1256271
Hi fvallejo,

every fourth  year  is  a  leap  year  except for century years
that are not divisible by 400

if (year % 4 == 0  and year % 100 != 0) or year % 400 == 0 then
    year is a leap year

Wilfred
0
 

Author Comment

by:fvallejo
ID: 1256272
consider the year 2000.
0
 
LVL 2

Expert Comment

by:wpinto
ID: 1256273
year 2000 IS a leap year since (year % 400) == 0
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question