Since I want to celebrate this definitely not nerdy event, your job is to calculate the piversary (pi-anniversary) of a given date.
Your code has to have a possibilty to input a date in the format
DD/MM/YYYY. You can expect, that the input is valid and the year is
You have to release two dates, the date in Pi months and the date in Pi years.
- If your language hasn't a build in Pi, you have to make a variable which will be exact enough to calculate the dates, but it is not allowed to calculate the days separately and use fix numbers.
- You have to take care, that the months have different amount of days, but you don't have to care about leap years (only if you want).
- If you calculate the date, you have to add the three years/months first and then the left part in rounded days.
- Your code has to accept any valid date and should be able to handle edge cases like
Input: 12/04/2010 Calculate monthly piversary: date + 3 months = 12/07/2010 date + (31*(Pi-3)) = date + 4.39 = date + 4 = 16/07/2010 //31 because July has 31 days Calculate yearly piversary: date + 3 years = 12/04/2013 date + (365*(Pi-3)) = date + 52 = 03/06/2013 Output: 16/07/2010,03/06/2013
May the shortest code win.