using System;
using System.Diagnostics;
public class Program
{
public static void Main()
{
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
int sum = 0;
for (int i = 0; i < 2000; i++) {
sum += (i * 2);
}
Console.WriteLine("sum = {0}", sum);
stopwatch.Stop();
TimeSpan ts = stopwatch.Elapsed;
Console.WriteLine("Execution time is {0:00}:{1:00}:{2:00}.{3}",
ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds);
}
}
/*
run:
sum = 3998000
Execution time is 00:00:00.13
*/