title: What is the appropriate way to append string to the end of the current line?
body: <p>I'm working through a practice problem for one of my classes and I'm having a bit of trouble with part of the prompt.</p>
  <p>We need to:</p>
  <ul>
  <li>Write code to go through number -20 - 20 (but skip 5-15 inclusively)</li>
  <li>If the number is negative, the line should start with an &quot;*&quot;</li>
  <li>If the number is divisible by 2, add &quot;#&quot; to the end of the current line</li>
  <li>If the number is divisible by 3, add &quot;!&quot; to the front of the line</li>
  <li>If the previous line has both &quot;!&quot; and &quot;#&quot;, then add &quot;wow&quot; to the end of the current line (Hint: use bool)</li>
  </ul>
  <p>With the code I've written so far, I've managed to complete the first two tasks on the list, but I run into trouble starting with the third task. In my code I'm using</p>
  <pre><code>if (num%2==0)
  {
     Console.WriteLine(num+&quot;#&quot;);
  }
  </code></pre>
  <p>but all it's doing is outputting another number with &quot;#&quot; instead of putting &quot;#&quot; on the current line. How do I make it so &quot;#&quot; is appended to the end of the current line?</p>
  <p>Here's my code for reference:</p>
  <pre><code>static void Main(string[] args)
      {
          int num = -20;
          while (num &lt;= 20)
          {
              if (num &lt; 5 || num &gt; 15)
              {
                  if (num &lt; 0)
                  {
                      Console.WriteLine(&quot;*&quot; + num);
                  }
                  if (num%2==0)
                  {
                      Console.WriteLine(num+&quot;#&quot;);
                  }    
                  else
                  {
                      Console.WriteLine(num);
                  }
              }
              num++;
          }
      }
  </code></pre>