title: Decimal To Binary Conversion
body: <p>I tried with this code in C# but could not get the desired output and i cudn't find where my mstaking in logic.  </p>
  
  <pre><code>int rem,n,num=0; 
  while(n&gt;0)  
  { 
      rem=n%2;  
      num=(num*10)+rem;  
      n=n/2;  
  }  
  Console.WriteLine(num);  
  </code></pre>
  
  <p>But it doesn't give me the right output please tell me how can i accomplish it.<br>
   Output:<br>
   6 after conversion it sould be 110 but its 11</p>