Thread View: comp.std.c
2 messages
2 total messages
Started by Scott Shrader
Thu, 21 Mar 1996 00:01
leap year
Author: Scott Shrader
Date: Thu, 21 Mar 1996 00:01
Date: Thu, 21 Mar 1996 00:01
13 lines
670 bytes
670 bytes
can anyone tell me in C how do I write a program so it can tell me if a year is a leap year. Please write to me at shrader@scsn.net Thank you, can anyone tell me in C how do I write a program so it can tell me if a year is a leap year. Please write to me at shrader@scsn.net Thank you, Scott
Re: leap year
Author: Erik Bachmann
Date: Fri, 22 Mar 1996 08:48
Date: Fri, 22 Mar 1996 08:48
36 lines
1397 bytes
1397 bytes
Scott Shrader wrote:
>
> can anyone tell me in C how do I write a program so it can tell me if a year
> is a leap year.
>
> Please write to me at shrader@scsn.net
>
> Thank you,
Here we go:
int LeapYear(int iYear)
{
if ( iYear % 4 == 0
&& iYear % 100 != 0
|| iYear % 400 == 0
)
return( 1 ) ; /* Is leap year */
else
return( 0 ) ;
} /*** LeapYear ***/
-- Regards
----------------------------------------------------------------
| | Dansk Data Elektronik A/S
__| __| __ Att.: Erik Bachmann
/ |/ |/__> Herlev Hovedgade 199
\__/\__/\__ DK-2730 Herlev, Denmark
_______ _______
(_) (_) Voice.: (+45) 44 53 92 00 | #|
| ::: | Fax...: (+45) 44 53 24 16 | NN | E-mail:
|_____| Telex.: 35258 dde dk |_______| ebp@dde.dk
----------------------------------------------------------------
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads