编写控制台程序,根据年月日计算当天是本年的第几天

敲出来程序显示错误 不能正常运行 有没有大神教教该怎么做这个程序 大学生c#课程

using System;

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("请输入日期(格式为 yyyy-MM-dd):");
        string input = Console.ReadLine();
        DateTime date = DateTime.Parse(input);

        int dayOfYear = date.DayOfYear;
        Console.WriteLine($"当天是本年的第 {dayOfYear} 天。");
    }
}