This question already has an answer here:
- Christmas Countdown 8 answers
The goal of this challenge is to create a program that outputs a string depending on the time of year.
If the date is December 25, output:
If the date is December 31 or January 1, output:
Have a Happy New Year!
If the date is between December 25 and December 31 (exclusive), output:
If the date is December 24, output:
1 day until Christmas!
If the date is before December 24, output:
x days until Christmas!
x is replaced with the numbers of days until Christmas Day. Beware of leap years :)
If your language does not have a builtin function to return the current date, you may have a time stamp passed as input to the program.
> Dec 25 2015 Merry Christmas! > Jan 1 2016 Have a Happy New Year! > Dec 24 2015 1 day until Christmas! > Jan 2 2016 358 days until Christmas! > Jan 2 2017 357 days until Christmas!
Since your program might be delivered by Santa next year, you need to make the program as small as possible so as many programs as possible can fit into his sack.