leap year by test

main = interact $ unlines . map(f.read) . words
f n| mod n 400<1 = show n++" is a leap year."
   | mod n 100<1 = show n++" is not a leap year."
   | mod n 4<1   = show n++" is a leap year."
   | otherwise   = show n++" is not a leap year."

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page