Knowing a given date (11/28/1973
), and supposing I will die when I'm 99, what are the years when my birthday will be a thursday so that I will be able to party all week-end?
\$\begingroup\$
\$\endgroup\$
2
-
\$\begingroup\$ The question as it stands will get only "print xx" answers, since there is no input on which the output is dependant on. \$\endgroup\$– shionaCommented Dec 29, 2013 at 22:17
-
\$\begingroup\$ This adds nothing interesting to existing questions such as this one. \$\endgroup\$– Peter TaylorCommented Dec 29, 2013 at 22:28
Add a comment
|
2 Answers
\$\begingroup\$
\$\endgroup\$
js
var y = 1973 + 99;
while(y-- > 1973) 4!=new Date('11/23/'+y).getDay()||console.log(y);
\$\begingroup\$
\$\endgroup\$
Something like this:
c#
var birthdate = new DateTime(1973,11,28);
for (int i = 0; i <= 99; i++)
{
var date = birthdate.AddYears(i);
if (date.DayOfWeek.Equals(DayOfWeek.Thursday))
{
Console.WriteLine(date.Year);
}
}