how to calculate running time of algorithm for this simple modulus operation?

33 Views Asked by At

With "n" being any positive integer, how many times the statement of while loop will be run, related to "n" please?

while(n%2 == 0) n=n/2
1

There are 1 best solutions below

2
On BEST ANSWER

Primes other than $2$ don't matter at all. Just try it with the numbers from $10$ through $16$ and you will probably see a pattern.