]> git.piffa.net Git - arduino/blob - books/beginning_c_code/Chapter06/Listing6_1/Listing6_1.ino
first commit
[arduino] / books / beginning_c_code / Chapter06 / Listing6_1 / Listing6_1.ino
1 /*****
2   Purpose: Determine if a given year is a leap year
3
4   Parameters:
5     int yr              The year to test 
6
7   Return value:
8     int                 1 if the year is a leap year, 0 otherwise
9 *****/
10 int IsLeapYear(int yr)
11 {
12   if (yr % 4 == 0 && yr % 100 != 0 || yr % 400 == 0) {
13     return 1;   // It is a leap year
14   } else {
15     return 0;   // not a leap year
16   }
17 }
18 \r