--- tags: DICE C --- 19-1 N的多項式 === > [name=CHAWTeam] 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) 題目 --- ```! 請寫一個程式,計算下列多項式之值。 F(n)=n*n+n+41,其中 n>=0 程式重複輸入,直到輸入的n<0才停止。 輸入範例: 5 10 11 -1 輸出範例: 71 151 173 ``` 程式碼 --- ```c= #include <stdio.h> int F(int n) { return n * n + n + 41; } int main() { int n = 1; while (n >= 0) { scanf("%d", &n); if (n >= 0) printf("%d\n", F(n)); } return 0; } ``` 執行 --- ### 輸入 ```! 5 10 11 -1 ``` ### 輸出 ```! 71 151 173 ``` --- [查看我們在HackMD上的所有筆記](https://hackmd.io/@CHAWTeam) 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) --- {%hackmd Iiu5mOixR7yWkPHKCkabBg %} <iframe class="LikeCoin" height="235" src="https://button.like.co/in/embed/chawteam/button?referrer=https://hackmd.io/@CHAWTeam/DiceC-19-1" width="100%"></iframe> --- {%hackmd i1nMRrZcTFmTvoF897K9zg %}