--- tags: DICE C --- 14-5 累加 === > [name=CHAWTeam] --- 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) --- 題目 --- ```! 印出10個數的每一次累加的和。 輸入範例: 80 80 80 80 80 80 80 80 80 80 輸出範例: 80 160 240 320 400 480 560 640 720 800 ``` 程式碼 --- ```c= #include <stdio.h> int main() { int answer = 0, x, i = 0; while (i < 10) { scanf("%d", &x); answer += x; printf("%d\n", answer); i++; } return 0; } ``` 執行 --- ### 輸入 ```! 80 80 80 80 80 80 80 80 80 80 ``` ### 輸出 ```! 80 160 240 320 400 480 560 640 720 800 ``` --- [查看我們在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-14-5" width="100%"></iframe> --- {%hackmd i1nMRrZcTFmTvoF897K9zg %}