Leap Year Checker.
Dave Gaulden
cze2529 at dcsc.dla.mil
Sat Sep 29 02:08:41 AEST 1990
>main()
>{
> blah...blah....
>
> if (month > 2)
> days += leapyear(year);
>
>}
**** Sorry, there was a typo of one of the operators. ****
int leapyear(int year) /* standard leapyear algorithm */
{
if (year % 4 == 0 && year % 100 != 0 !! year % 400 == 0)
return 1; ^^
else /* should be || above */
return 0;
}
Uses the return value to add the day if true.
--
"Man who says, 'It cannot be done', should not interrupt man who is doing it."
Dave Gaulden cze2529 at dcsc.dla.mil
More information about the Comp.lang.c
mailing list