Mar092017, 05:35 PM
Bottom Page
Top Page
Users browsing this thread: 1 Guest(s)
Thread Rating:
Leap Year

Mar092017, 05:45 PM
(This post was last modified: Mar092017, 05:46 PM by MartinEvtimov.)
(Mar092017, 07:07 AM)wavic Wrote: Hello! This is working for me but why is 400 not a leap year? (Mar092017, 07:02 AM)buran Wrote: Please, wrap your code in code tags. I'm apologize for the confusion I meant to say 100 not 400
Mar092017, 07:25 PM
The algorithm states:
The year is evenly divisible by 4; If the year can be evenly divided by 100, it is NOT a leap year, unless; The year is also evenly divisible by 400. Then it is a leap year. Why the year divided by 100 is not leap year. Quote:A "truth" table that shows a number divisible by 400 and not by 4 or not by 100, hmmph. Welcome to "alternate mathematics" It can be divisable evenly by 100 and not by 400 right? say 500 I did not simplify.
Mar092017, 11:49 PM
(Mar092017, 07:25 PM)Larz60+ Wrote: The algorithm states: Let's be accurate: it's not "the algorithm states" it is "one possible expression of the algorithm is". For reference, the leap year article on Wikipedia expresses it as: if (year is not divisible by 4) then (it is a common year) else if (year is not divisible by 100) then (it is a leap year) else if (year is not divisible by 400) then (it is a common year) else (it is a leap year)and it uses a nondivisibility criterion instead of a divisibility one (and doesn't use "unless"). As a programmer, I find it hard to read because the case "divisible by 400" is really the final "else", so I find this more readable: if (year is by 400) then (it is a leap year) else if (year is divisible by 100) then (it is a common year) else if (year is divisible by 4) then (it is a leap year) else (it is a common year) (Mar092017, 07:25 PM)Larz60+ Wrote: It can be divisable evenly by 100 and not by 400 right? say 500 I'm talking about these two lines. They are about some hypothetical number that can be divided by 400 but not by 4 (the first) or by 100 (the second). (Mar092017, 02:45 PM)Larz60+ Wrote:
zivoni likes this post
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for CtrlC/CtrlV.
Your onestop place for all your GIMP needs: gimpforum.net
Mar102017, 01:46 AM
(This post was last modified: Mar102017, 01:46 AM by Larz60+. Edited 3 times in total.)
NIST definition 
Quote:Leap years are years with 366 days, instead of the usual 365. Leap years are necessary because the actual length of a year is about 365.242 days, not 365 days, as commonly stated. Basically, leap years occur every 4 years, and years that are evenly divisible by 4 (2004, for example) have 366 days. This extra day is added to the calendar on February 29th.Now I have to go back and examine what I stated earlier. Looks like you're right again As an nonsimplified truth table mine may be correct as well if simplified, I believe the results would be that same as yours 
« Next Oldest  Next Newest »

Top Page
Possibly Related Threads...  
Thread  Author  Replies  Views  Last Post  
Creating folders dynamically with year/month/date  sritsv  0  2,838 
Oct162017, 03:44 PM Last Post: sritsv 

Calculating what year it is when you are 100 years old  dankim9000  2  5,326 
Apr262017, 08:03 PM Last Post: dankim9000 

leap year program issue  jashajmera  3  1,606 
Feb042017, 11:51 AM Last Post: ichabod801 

Logic to convert an integer to YEAR / MONTH  hugobaur  9  2,985 
Oct182016, 11:58 AM Last Post: hugobaur 
Users browsing this thread: 1 Guest(s)