Day of the Week by 51b

-module(d).
-export([m/0]).
m()->case io:fread('',"~d~d~d")of{_,[Z,N,D]}->[Y,M]=if N<3->[Z-1,N+18];0<1->[Z,N+6]end,io:write((Y+Y div 4-Y div$d+Y div 400+M*13div 5+D)rem 7),io:nl(),m();_->0end.

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

download

return to the top page