Find the average of my Stopwatch timer
I need to find the average of stopwatch timer , I dont know how to deal it with? <br /><br /><div class="dp-highlighter"><ol class="dp-c" start="1"><li class="alt"><span><span>Console.WriteLine(</span><span class="string">"\nThe time Recursive method take -->"</span><span> </span></span></li><li class=""><span> + (timer.Elapsed.TotalMilliseconds)); <br /></span></li></ol></div>A friend told me to store this above value into some variable and just find the average ? But I dont know how to do it ?<br /><br />Here is my full code : <br /><br /><div class="dp-highlighter"><ol class="dp-c" start="1"><li class="alt"><span><span>Stopwatch timer1 = </span><span class="keyword">new</span><span> Stopwatch(); </span></span></li><li class=""><span> <span class="keyword">while</span><span> (timer1.ElapsedMilliseconds>1200) </span></span></li><li class="alt"><span> { </span></li><li class=""><span> result = test(seed, count); </span></li><li class="alt"><span> } </span></li><li class=""><span> <span class="keyword">for</span><span> (</span><span class="keyword">int</span><span> k = 0; k < 5; k++) </span></span></li><li class="alt"><span> { </span></li><li class=""><span> timer1.Reset(); </span></li><li class="alt"><span> timer1.Start(); </span></li><li class=""><span> Console.WriteLine(<span class="string">"\nThe time NonRecursive method take -->"</span><span> </span></span></li><li class="alt"><span> + timer1.Elapsed.TotalMilliseconds.ToString()); </span></li><li class=""><span> } </span></li><li class="alt"><span> </span></li><li class=""><span> timer1.Stop(); <br /></span></li></ol></div>