--- tags: DICE C --- 21-2 x的y次方 === > [name=CHAWTeam] 目錄:[DICE C語言程式破解](/@CHAWTeam/DiceC) 題目 --- ```! 使用數學函數pow(x,y)函式,計算x的y次方,直到輸入的x=0為止。 輸入範例: 3 2 4 3 10 2 5 4 6 3 0 輸出範例: 9 64 100 625 216 ``` 程式碼 --- ```c= #include <stdio.h> #include <math.h> int main() { int x, y; scanf("%d %d", &x, &y); while (x != 0) { printf("%.f\n", pow(x,y)); scanf("%d %d", &x, &y); } return 0; } ``` 執行 --- ### 輸入 ```! 3 2 4 3 10 2 5 4 6 3 0 ``` ### 輸出 ```! 9 64 100 625 216 ``` --- [查看我們在HackMD上的所有筆記](/@CHAWTeam) 目錄:[DICE C語言程式破解](/@CHAWTeam/DiceC) --- {%hackmd Iiu5mOixR7yWkPHKCkabBg %} <iframe class="LikeCoin" height="235" src="https://button.like.co/in/embed/chawteam/button?referrer=https://hackmd.io/@CHAWTeam/DiceC-21-2" width="100%"></iframe> --- {%hackmd i1nMRrZcTFmTvoF897K9zg %}