title: Finding smallest value in array
body: <p>I need to find the smallest value which is larger than 0 among all integers stored in an array. I tried some of the ways of doing that on stackoverflow, but my minimal value still equals to 0 in all cases.
  What should I change in my code to make it work?</p>
  
  <pre><code>int[] userInput = new int[1000];
          int counter;
  
          Console.WriteLine ("Please input some numbers");
  
          for (counter = 0; counter &lt; userInput.Length; counter++) {
              string line = Console.ReadLine ();
  
              if (line == "" || line == "stop") {
                  break;
              } else {
                  int.TryParse (line, out userInput [counter]);
              }
          }
          int min = 0;
          for(int i = 0; i &lt; userInput.Length; i++)
          {
              if(userInput[i] &gt; 0)
              {
                  userInput[i] = min;
                  break;
              }
          }
          for(int i = 0; i &lt; userInput.Length; i++)
          {
              if(userInput[i] &lt; min &amp;&amp; userInput[i] &gt; 0)
              {
                  min = userInput [i];
              }
          }
          Console.WriteLine(min);
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I would like to do it without using LINQ.</p>