What is the value of i after the following code snippet exec

What is the value of i after the following code snippet executes? Please give a brief explanation on binary numbers

Solution

Dear Student

Thank you for using Chegg !!

As per given code statement integer i is initialized with 17 (i.e. (binary 0001 0001)and then it is shifted 1 bit to the right. i.e. zero shifted in from the left, 1 shifted out to the right:

So the value of i becomes (00001000 in binary)

or 8 as integer value

Therefore value of i after the following transcript = 8

Solution

Since i has been has been shifted 1 bit to the right it becomes

What is the value of i after the following code snippet executes? Please give a brief explanation on binary numbersSolutionDear Student Thank you for using Cheg

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site