+ 1
Loop structure c
Could someone explain the answer (12) in the quiz question below: How may times will âSololearnâ be printed in this statement below? int i = 2048; While (i) { printf(âSololearn\nâ); i >= 1; }
3 Answers
+ 1
i>>=1 here it means i = i >>1, >> right shift operator..
After first iteration,
i = 1024
Next I = 512,
=> 256
=> 128
=> 64
=> 32
=> 16
=> 8
=> 4
=> 2
=> 1
=> 0
Total 12 times loop runs.
Edit : see this for more.. Joe Bosah
https://www.sololearn.com/learn/4086/?ref=app
+ 1
thank you so much
+ 1
You're welcome..