A=~5 B=3 A*B=? And explain what ~ does | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 3

A=~5 B=3 A*B=? And explain what ~ does

Got this qn in challenge

14th Jun 2020, 3:02 AM
Swopnil
Swopnil - avatar
1 Antwort
0
TILDE OPERATOR (called also 'complement' or 'invert' operator) is expressed by this formula: ~n = -n - 1 This means that ~5 gives -6 It can be applied only to integers. Curiously can be applied also to booleans. In this case True is replaced with 1 and False is replaced with 0: ~True = -2 ~False = -1
14th Jun 2020, 5:11 AM
Bilbo Baggins
Bilbo Baggins - avatar