From: wwp <subscript@free.fr>
To: linux-c-programming@vger.kernel.org
Subject: Re: A Calendar app on C
Date: Wed, 2 Jun 2004 12:38:52 +0200 [thread overview]
Message-ID: <20040602123852.7ff77abf@localhost> (raw)
In-Reply-To: <1086167937.23773.24.camel@localhost>
Hello John,
On Wed, 02 Jun 2004 05:18:57 -0400 "John T. Williams" <jowillia@vt.edu> wrote:
> isn't there some rule about if the year is year%100=0 then is has to
> also be yea%400 to be a leap year?
Yes there is! Google would report many pages around this.
According to http://www.mitre.org/tech/cots/LEAPCALC.html:
if (year mod 4 != 0)
{use 28 for days in February}
else if (year mod 400 == 0)
{use 29 for days in February}
else if (year mod 100 == 0)
{use 28 for days in February}
else
{use 29 for days in February}
Regards,
> On Wed, 2004-06-02 at 03:17, Christian Beckel wrote:
> > oops, I forgot to test if there is a leap or not, the first line should be:
> >
> > if (i == 2)
> > days = (i % 4 != 0) ? 28 : 29;
> >
> >
> > > Hi,
> > >
> > > there are several possibilities to compute the number of days in a month or
> > > if there is a leap or not.
> > >
> > > if (i == 2)
> > > days = 28;
> > > else
> > > days = 31 - ( (i != 4 || i != 6 || i != 9 || i != 11) ? 1 : 0 );
> > >
> > > I think there is no simpler way, because the numbers of months are
> > > unregular.
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
wwp
next prev parent reply other threads:[~2004-06-02 10:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-02 5:58 A Calendar app on C Fabio Miranda Hamburger
2004-06-02 7:10 ` Christian Beckel
2004-06-02 7:17 ` Christian Beckel
2004-06-02 9:18 ` John T. Williams
2004-06-02 10:38 ` wwp [this message]
2004-06-02 10:07 ` Glynn Clements
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040602123852.7ff77abf@localhost \
--to=subscript@free.fr \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.