下面代码用于统计 n 中因子 2 出现了多少次。若 n = 40,输出是( )。 int n = 40; int cnt = 0; while (n % 2 == 0) { cnt++; n /= 2; } cout << cnt; A. 1 B. 2 C. 3 D. 4