Calendar
(Challenge added 728 days ago.)
Why buy calendars, when you can make your own?
The Problem
Your task, should you choose to accept it, is to write the shortest program that will display the full calendar for any year between 1753 and 2399 inclusive. Sounds simple enough, but there are a few gotchas you need to look out for, you have to format it in a specific way, and of course, do it in the least number of characters possible.
The format we want your program to generate is largely the same as the UNIX command cal. Don't worry if you're not familiar with cal's output or don't have access to it, you don't need it to take part in this challenge.
You might find the information at Wikipedia's Gregorian calendar page useful.
Other Information
- Your program will be run 7 times. The first four times you will be asked to generate calendars for the years 1900, 2000, 2399 and 1753. The next three times you will be asked to generate calendars for three random years in the range 1753-2399 inclusive. These last three years will be different each time.
- Each year will be provided on stdin (followed by a newline), and only one year per run will be provided. Your output is expected on stdout.
Rather than labourously explaining the format of the output, part of the exercise is to work out the general format yourself from the examples below!
Examples
As mentioned above, the first four runs will be run for the same years each time. To see the expected output for these runs, click the following links :
For the other runs, you'll receive random years.
- Generate the output for a random year. Reload the page to get another random year.
