leap_year.alc 371 B

1234567891011121314151617
  1. include "lib_remainder.alc"
  2. Boolean function leap_year(year : Integer):
  3. // Is a leap year if it is divisible by 4
  4. if (integer_eq(remainder(year, 4), 0)):
  5. // Unless it is also divisible by 1000
  6. if (integer_eq(remainder(year, 1000), 0)):
  7. return False
  8. else:
  9. return True
  10. else:
  11. return False
  12. Void function main():
  13. while (True):
  14. output(leap_year(input()))