Tidyied output
[project-euler.git] / euler19.rb
1 require 'date'
2 require 'logger'
3 log = Logger.new(STDERR)
4 log.level = Logger::WARN
5
6 sundays = 0
7 1901.upto(2000) do |year|
8 1.upto(12) do |month|
9 sundays += 1 if Date.new(year, month, 1).sunday?
10 log.debug { "#{Date.new(year, month, 1)} is daynum #{Date.new(year, month, 1).cwday}"}
11 log.info { "#{Date.new(year, month, 1)} is a sunday, making #{sundays} so far" } if Date.new(year, month, 1).sunday?
12 end
13 end
14
15 if __FILE__==$0
16 puts sundays
17 end
18
19 log.close