main.m286 chars11 lines
This function takes in one argument, which is the year to be checked. The modulo operator is used to determine if the year is divisible by 4, 100, and 400. If the year is divisible by 4 and either not divisible by 100 or divisible by 400, then it is a leap year and the function returns 0. Otherwise, the function returns 1.
To call this function and check if a year is a leap year or not, you can simply enter the year as an input argument in the command window:
main.m70 chars7 lines
gistlibby LogSnag