Solved

Get leap year

Posted on 1997-11-12
4
468 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
Comment Utility
(year%4==0)^(year%100==0)^(year%400==0)
0
 
LVL 2

Accepted Solution

by:
wpinto earned 50 total points
Comment Utility
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
Comment Utility
consider the year 2000.
0
 
LVL 2

Expert Comment

by:wpinto
Comment Utility
year 2000 IS a leap year since (year % 400) == 0
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

762 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

13 Experts available now in Live!

Get 1:1 Help Now