Main(){ signed int bit=512, i=5; for(;i;i--) { printf("%dn", bit = (bit >> (i - (i -1)))); }}

A) 128, 64, 32, 16, 8
B) 256, 128, 64, 32, 16
C) 512, 256, 128, 64, 32
D) 64, 32, 16, 8, 4

Showing Answers 1 - 2 of 2 Answers

satyam_un

  • Mar 13th, 2006
 

ans is Bbecause the will b terminated after i=0;bit>>(i-(i-1)))means first it assignsi=5.the first value for bit is512>>(5-(5-1))=512>>1=512/2/1=256

  Was this answer useful?  Yes

sittoop

  • Feb 25th, 2009
 

Right shift a number by 1 is equivalent to division of that number by 2^1.
Right shift a number by 2 is equivalent to division of that number by 2^2.
Applying that, the answer is 256, 128, 64, 32, 16
(left shift is opposite ~ multiplication)

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions