title: Flip the binary
body: <p>I want to flip the binary to <code>1</code> or <code>0</code>. For example I have the binary <code>101</code> the output should be <code>010</code>. I've been trying to iterate through the array and change the value but the output is always <code>0, 000, 0000, 00</code>.</p>
  
  <p>HERE is the code i'm working with:</p>
  
  <pre><code>static void Main(string[] args)
      {
          Console.Write("Input Binary: ");
          String x = Console.ReadLine();
          char[] bin = x.ToCharArray();
          int[] nbin =  new int[bin.Length];
  
          for (int i = 0; i &lt; bin.Length; i ++)
          {
  
              int a = bin[i];
              if(a == 0)
              {
  
                  nbin.SetValue(1, i);
  
              }
              if(a == 1)
              {
  
                  nbin.SetValue(0, i);
              }
  
          }
  
          foreach (var e in nbin)
          {
              Console.Write(e);
          }
  
          Console.Read();
      }
  </code></pre>