0
Negative numbers
How would you express a negative number in coding
2 odpowiedzi
+ 4
Just like -150. You can check like
if(num < 0) //negative number
+ 1
Just like AJ #Learn With Me 👨💻 said.
You can Express negative numbers just like in maths.
If you want to know how negative numbers are represented as binary inside machine language, then read next.
The magnitude of the number is converted to 8bit binary, then its converted to 1's compliment, and then 2's compliment. Its a bit advanced concept.