CSharp - Write program to get the date of the nearest Friday and the number of days remaining

Requirements

You will write a program that displays the date of the nearest Friday and the number of days remaining.

Hint

When you subtract two dates, the result is a TimeSpan object.

Its Days property says how many days have passed during the "time span" between the two dates.

Demo

using System;
class Program/*w w  w  . ja v a 2s .  com*/
{
    static void Main(string[] args)
    {
        // Today's date 
        DateTime today = DateTime.Today;

        // Moving day after day until hit on Friday 
        DateTime date = today;
        while (date.DayOfWeek != DayOfWeek.Friday)
        {
            date = date.AddDays(1);
        }

        // Calculating remaining days 
        TimeSpan dateDifference = date - today;
        int daysRemaining = dateDifference.Days;

        // Outputs 
        Console.WriteLine("Nearest Friday: " + date.ToShortDateString());
        Console.WriteLine("Remaining days: " + daysRemaining.ToString());
        if (daysRemaining == 0)
        {
            Console.WriteLine("Thanks God!");
        }
    }
}

Result