int func(int num) { int count = 0; while(num) { count++; num >>= 1; } return(count) ; }For func(435) the value returned is | SoloLearn: Learn to code for FREE!

+5

int func(int num) { int count = 0; while(num) { count++; num >>= 1; } return(count) ; }For func(435) the value returned is

Please solve and answer earliest possible

3/27/2020 5:11:29 AM

Raj Kalash Tiwari

4 Answers

New Answer

+3

Work it out guys ">>=" is a compound right shift operator and it works like x = x / 2^n (2 raise to n) so if x = 4 then x >>= 1 = 2 (x = x/2) if x = 5 x >>= 1 = 2 (x = x/2, takes only the integer part)

+9

Jay Matthews need explaination. I couldnt get it how

+2

Code playground has the answer.

+1

Jay Matthews Where is answer ???