title: C convert decimal number to binary using union
body: <p>I have this code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  int main(void)
  {
      long long int n,b,t,j;
      while(scanf("%llu",&amp;n) &amp;&amp; n)
      {
          char a[2000]={0},c[2000]={0};
          b=0;
          int k=0;
  
          while(n&gt;0)
          {
              a[b++]=(n%2)+48;
              if(n%2==1)
              k++;
              n=n/2;
          }
              a[b]='\0';
              j=strlen(a)-1;
  
          for(b=j,t=0;b&gt;=0;b--)
  
              c[t++]=a[b];
              c[t]='\0';
  
          printf("The parity of %s is %d (mod 2).\n",c,k);
      }
  
  return 0;
  }
  </code></pre>
  
  <p>This code working perfect.</p>
  
  <p>Now I want to convert decimal number to binary using union in C</p>
  
  <p>How can I do that?</p>