以下代码使用了辗转相除法求解最大公因数,请在横线处填入( ),使其能正确实现相应功能。
int gcd(int a, int b) {
while (b != 0) {
____________
}
return a;
}
- A. ```cpp
int temp = b; b = a / b; a = temp;
- **B.** ```cpp
int temp = a; a = b / a; b = temp;
- C. ```cpp
int temp = b; b = a % b; a = temp;
- **D.** ```cpp
b = a % b; a = b;