0 votes 0 votes #include<stdio.h> int main() { int a=2; if(a==2) { a=~a+2<<1; printf("%d",a); } } Programming in C output programming programming-in-c + – Parshu gate asked Nov 19, 2017 Parshu gate 360 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 2 votes 2 votes Priority of operators: "~" > "+" > "<<" "~" is 1's complement operator for example: if x=4 = 0100, then ~x =1011 =-5 in given ques. a=2 {0010} ~a= -3 {1101} ~a+2 = -3+2 = -1 now, -1<<1 = -2 o/p: -2 Akash Mittal answered Nov 20, 2017 selected Nov 20, 2017 by Parshu gate Akash Mittal comment Share Follow See 1 comment See all 1 1 comment reply gari commented Jan 17, 2018 reply Follow Share why 1101 is not considered as 13.. why we have taken it as a signed number... 0 votes 0 votes Please log in or register to add a comment.