title: making 1's complement, why it doesn't work if i put a negative number
body: <p>it works well if i put positive numbers but it doesn't work if i put negative numbers.
  however it works if i copy and paste the only 1's complement part's codes.
  if i put -12, it shows absolute : 10001100 and 1's complement: 11110011. 
  idk why it doesn't work help :(</p>
  
  <pre><code>    //1's complement_1
      {
          printf("\n 1's complement:");
          if (decimal_1 &lt; 0)
          { decimal_1 = - decimal_1; bi_1[0] = 1; }
              for(i_1=7; i_1&gt;0 ;i_1--)
              {
                  bi_1[i_1]=decimal_1%2;
                  decimal_1=decimal_1/2;
              }
              Fcomplement_1[0]=1;
              for(i_1=1 ; i_1&lt;8; i_1++ )
              {
                  if (bi_1[i_1]==0)
                      Fcomplement_1[i_1]=1;
                  else
                      Fcomplement_1[i_1]=0;
              }
              for(i_1=0; i_1&lt;8; i_1++)
                  printf("%d", Fcomplement_1[i_1]);
          }
          else
              for (i_1=0 ; i_1&lt;8 ; i_1++)
                  printf("%d",bi_1[i_1]);
      }
      return 0;
  }
  </code></pre>