Saturday 2 December 2017

C# Program to Create Stop Watch


Code:

using System;
using System.Diagnostics;
using System.Threading;
class Program
{
    static void Main()
    {
        // Create new stopwatch
        Stopwatch stopwatch = new Stopwatch();
        // Begin timing
        stopwatch.Start();        
        for (int i = 0; i < 10; i++)
        {
            Console.WriteLine("HI");
        }
        // Stop timing
        stopwatch.Stop();
        Console.WriteLine("Time Elapsed : {0}",
            stopwatch.Elapsed);
        Console.ReadLine();
    }
}


Output:

HI
HI
HI
HI
HI
HI
HI
HI
HI
HI
Time Elapsed : 00:00:00.0015114


More C# Programs:



















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...