Solved

Get leap year

Posted on 1997-11-12
4
469 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

939 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now