title: C comparing binary numbers with xor
body: <p>this is part of the code. Here, I want to compare digits by xor.
  So it suppose to give "0111" but it gives "111" as result.
  How can I fix it?
  So it suppose to give "0111" but it gives "111" as result.
  How can I fix it?</p>
  
  <pre><code>1 and 1 = 0
  1 and 0 = 1
  0 and 1 = 1
  0 and 0 = 0
  
  
  
  #include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;math.h&gt;
  int main()
  
  {   
      int BinaryRepForDisk1=1101, BinaryRepForDisk2=1010, Disk3=0, xor1, xor2, power=0;
  
      while(BinaryRepForDisk1!=0)
      {
          xor1=BinaryRepForDisk1%2;
          xor2=BinaryRepForDisk2%2;
  
          if(xor1==xor2)
          {
              Disk3=Disk3+pow(10,power)*0;
              power++;
          }
  
          else
          {
              Disk3=Disk3+pow(10,power)*1;
              power++;        
          }   
  
          BinaryRepForDisk1=BinaryRepForDisk1/10;
          BinaryRepForDisk2=BinaryRepForDisk2/10;
      }   
      printf("%d",Disk3);
  
  
  
      system("pause");
      return 0;
  }
  </code></pre>