mercredi 16 décembre 2020

Convert Negative numbers into binary using the One's and Two's Compliment Method in PYTHON [closed]

can you help me create a CODE Convert Negative numbers into binary using the One's and Two's Compliment Method Steps:

  1. Convert the Negative number into a positive binary first
  2. Convert the new value into binary (Continue dividing by 2, then reverse the remainders)
  3. Perform the one's complement by inverting every binary digit
  4. Perform the two's complement by adding 1 to the new binary value Note: Do not forget the magnitude bit, use 1 magnitude bit Example: -16 is 16 as positive, 10000 as binary, 010000 as a binary with 1 magnitude bit



Aucun commentaire:

Enregistrer un commentaire