- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int f(int n) {
- int sum = 0;
- while (n) {
- n = n - n % 5;
- sum = sum + n % 6;
- n = n / 5;
- }
- return sum;
- }
- int main() {
- cout<<f(499);
- system("pause");
- return 0;
- }
複製代碼 問 f(100) 和 f(499) 回傳是 6 和 11,___ 填多少
(A) sum = sum - n / 5
(B)sum = sum + n / 5
(C) sum = sum + n / 6
(D)sum =sum + n % 6
本帖隱藏的內容需要回復才可以瀏覽 |