0

#include <iostream> using namespace std; int main() { int a=10,c=2,b; b=a>>c; cout<<b; return 0; }

why output is 24?

28th Aug 2017, 8:19 AM
Rishabh Rai
Rishabh Rai - avatar
2 Answers
+ 2
Output should be 2 not 24. 10 >> 2 = 2 10 in binary = 1010 right shift 2 = 0010 = 2
28th Aug 2017, 8:36 AM
ChaoticDawg
ChaoticDawg - avatar
0
sorry..I posted wrong question..
28th Aug 2017, 1:03 PM
Rishabh Rai
Rishabh Rai - avatar