second %d will take value of x after left shifting it twice, and shifting is done after converting the values to binary, binary value of 5 (000101)will be left shifted twice to make it binary 20(0010100), so x<<2 is 20
and as left shifting does not effect the original value of x its still 5 so third %d will also show 20.
Thanks
 Posted by: Vishwas Rathi
Contact Author
Look.......... Inside printf function the expression are evaluated Right to Left. Hence first rightmost x<<2 will be executed then x<<2 in middle and at last x. << is the left shift operator which shifts bits of a number to left. So value of x<<2 when x=5 will be 20; value of x changes to 20 Again x<< 2 , when x=20 makes x=80; So values will be pinted in output screen as: 80,80,20
Since << is a left shift operator, and left shifting by one bit multiplies the number by 2, left shifting by 2 bits multiplies the number by four. However the original number is not assigned withe the new value.
Hence 5<<2 = 20 However teh value of x doesnt not change.. Hence the expression is like, print("%d,%d,%d",5,5<<2,5<<2) which will display 5,20,20
 Posted by: ram
Contact Author
5 is 101 5<<1 left shift by 1 1010 i.e 10 5<<2 left shift by 2 10100 i.e 20
 Posted by: sivaji
Contact Author
ans:5,20,20 because the << operator gives the product of the left integer(i.e x=5) and the maximum number of possible binary numbers that can be obtained for the given right integer.(i.e 2)
using two binary bits we can create four different combinations.If the given number is 3 then the number of possible combinations is 2^3=8. so the expression x<<2 gives X*2^2.