TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nilesh Jadav
84
23.1k
15.4m
Find the average of my Stopwatch timer
Sep 28 2016 8:41 AM
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>
Reply
Answers (
5
)
Import with formula issue.
Remove character from String