不断折半要几次

单选题 难度 3

#while#complexity

这就是 log 的来历。

题目

下面代码执行后 c 的值是( )。

int n = 100, c = 0;
while (n > 1) { n = n / 2; c++; }
  1. 6
  2. 7
  3. 50
  4. 100
来小码星球,动手写一遍 →