#2408. [GESP202312 二级 C++] 第 15 题
[GESP202312 二级 C++] 第 15 题
输入一个正整数N,想找出它所有相邻的因数对,比如,输入12,因数对有(1,2)、(2,3)、(3,4)。下面哪段代码找不到所有的因数对?( )
{{ select(1) }}
for(i=1;i<N;i++) if(!(N%i) && !(N%(i+1))) printf("(%d,%d)\n", i, i+1);for(i=2;i<N;i++) if(!(N%i) && !(N%(i+1))) printf("(%d,%d)\n", i, i+1);for(i=2;i<N/2;i++) if(!(N%(i-1)) && !(N%i)) printf("(%d,%d)\n", i-1, i);for(i=1;i<N/2;i++) if(!(N%i) && !(N%(i+1))) printf("(%d,%d)\n", i, i+1);