- 6

Questions : print(5|3) (Me:🤣It's Error) >>> 7(Me:🤣😆😅🤤What!!!) How?

17th Sep 2020, 12:44 PM
Name
Name - avatar
3 Respuestas
+ 7
DEC BIN 5 0101 3 0011 ---------------- | OR 7 0111 OR operator yields true (1) when either of its operands were true.
17th Sep 2020, 12:52 PM
Ipang
+ 7
Hi format your question properly , | is binary OR operatoror that compres the value between two numbers bits, if it's 1 or 0 returns 1 ,if it's 1 or 1 return 1 and if it's 0 or 0 returns 0 , Binary value of 5 is 0b101 Binary value of 3 is 0b011 If you apply the above operator you get 0b111 which is equal to 7 in decimal
17th Sep 2020, 12:52 PM
Abhay
Abhay - avatar
17th Sep 2020, 12:51 PM
Seb TheS
Seb TheS - avatar