Date and time continuous Learn programming C#

Lesson:

Additional Libraries


Exercise:

Date and time continuous 60


Objetive:

Create a program to display the current time in the upper right corner of the screen, with the following format:

12:52:03

it must pause for a second and display it again, in the same position.


Code:

using System;
using System.Threading;
class DateAndTimeContinuos
{
    static void Main()
    {
        while (true)
        {
            string time = DateTime.Now.ToLongTimeString();

            Console.SetCursorPosition(72, 1);
            Console.Write(time);

            Thread.Sleep(1000);
        }
    }
}