#3601. [GESP202606 五级 C++] 第 8 题
[GESP202606 五级 C++] 第 8 题
下面代码用于统计 n 中因子 2 出现了多少次。若 n = 40 ,输出是( )。
int n = 40;
int cnt = 0;
while (n % 2 == 0) {
cnt++;
n /= 2;
}
cout << cnt;
{{ select(1) }}
1234
下面代码用于统计 n 中因子 2 出现了多少次。若 n = 40 ,输出是( )。
int n = 40;
int cnt = 0;
while (n % 2 == 0) {
cnt++;
n /= 2;
}
cout << cnt;
{{ select(1) }}
1234