Advertisement
g-stoyanov

BinaryOddCheckerTest

Feb 23rd, 2015
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1. static void Main(string[] args)
  2.         {
  3.             Stopwatch timer = new Stopwatch();
  4.             timer.Start();
  5.  
  6.             for (int i = 0; i < 1000000; i++)
  7.             {
  8.                 if ((i & 1) == 0)
  9.                 {
  10.                     //Console.WriteLine(i);
  11.                 }
  12.                 else
  13.                 {
  14.                     //Console.WriteLine(-i);
  15.                 }
  16.             }
  17.  
  18.             timer.Stop();
  19.             Console.WriteLine(timer.Elapsed);
  20.             timer.Reset();
  21.             timer.Start();
  22.             for (int i = 0; i < 1000000; i++)
  23.             {
  24.                 if (i % 2 == 0)
  25.                 {
  26.                     //Console.WriteLine(i);
  27.                 }
  28.                 else
  29.                 {
  30.                     //Console.WriteLine(-i);
  31.                 }
  32.             }
  33.  
  34.             timer.Stop();
  35.             Console.WriteLine(timer.Elapsed);
  36.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement