Write cal.rb algorithm in pseudocode