這個要求可以用一個簡易的for 迴圈來達成. int sum(int n) { int i; int tmp=0; for (i=0; i<n; i++) tmp = tmp + (i+1); return tmp; }.
確定! 回上一頁