using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TestConsole { class Program { static void Main(string[] args) { var targetdate = new DateTime(2015, 1, 1); int count = 0; for (;;) { if (targetdate.Year == 2016) { break; } if (targetdate.Month == targetdate.Day % 10 + targetdate.Day / 10) { count++; } targetdate = targetdate.AddDays(1); } Console.WriteLine(count); } } }