title: Why can't i get the right output in decimal to binary conversion?
body: <pre><code>printf("Enter a positive integer");
  unsigned int ip;
  scanf("%d", &amp;ip);
  printf("\n Binary Conversion: ");
  int c,k,count = 1;
  for(c = 31; c &gt;= 0; c--) {
      k = ip &gt;&gt; c;
      if(k &amp;&amp; 1) {
          printf("1");
      } else {
          printf("0");
      }
  
      if(count % 8 == 0) {
          printf(" ");
      }
       count++;
  }
  </code></pre>
  
  <p>For some reason it doesn't give me the correct output even if i remove the unassign also. </p>