丝路商队计算行程,已知每天走30公里,输入总路程n=125,运行下列代码输出结果是?() #include using namespace std; int main() { int n=125, day=30; // 总量125,每天30 // 判断125能否被30整除 if(n%day==0) cout << n/day; // 能整除,直接输出商 else cout << n/day + 1; // 不能整除,商+1(向上取整) return 0; }
A:4
B:5
C:6
D:7
正确答案:B
试卷来源:2026年丝路新程 C++编程(小学组4-6年级)模拟卷(三)