+ 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 Antworten
+ 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..