title: Writing FizzBuzz
body: <p>Reading the coding horror, I just came across the FizzBuzz another time.</p>
  
  <p>The original post is here: <a href="http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html" rel="nofollow noreferrer">Coding Horror: Why Can't Programmers.. Program?</a></p>
  
  <p>For those who do not know: 
  FizzBuzz is a quite popular children's game. Counting from 1 to 100,
  and every time a number is divisible by 3 the string "Fizz" is called, every time
  a number is divisible by 5 the string "Buzz" is called and every time a number
  is divisible by 3 and 5 both strings together "FizzBuzz" are called instead of the number.</p>
  
  <p>This time, I wrote the code and it took me a minute,
  but there are several things that I do not like.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>public void DoFizzBuzz()
  {
      var combinations = new Tuple&lt;int, string&gt;[] 
      { 
          new Tuple&lt;int, string&gt; (3, "Fizz"), 
          new Tuple&lt;int, string&gt; (5, "Buzz"), 
      };
  
      for (int i = 1; i &lt;= 100; ++i)
      {
          bool found = false;
  
          foreach (var comb in combinations)
          {
              if (i % comb.Item1 == 0)
              {
                  found = true;
                  Console.Write(comb.Item2);
              }
          }
  
          if (!found)
          {
              Console.Write(i);
          }
  
          Console.Write(Environment.NewLine);
      }
  }
  </code></pre>
  
  <p><strong>So my questions are:</strong></p>
  
  <ol>
  <li>How do I get rid of the bool found? </li>
  <li>Is there a better way of testing
  than the foreach?</li>
  </ol>