--- tags: DICE C --- 16-7 公比 === > [name=CHAWTeam] --- 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) --- 題目 -- ```! 輸入第1個整數代表公比, 再輸入第2個整數代表上限, 從1開始,列出其小於等於第2個整數的公比數列。 輸入範例: 5 100 輸出範例: 1 5 25 ``` 程式碼 -- ```c= #include <stdio.h> int main() { int commonRatio, max; scanf("%d %d", &commonRatio, &max); for (int i = 1; max >= i; i *= commonRatio) { printf("%d ", i); } return 0; } ``` 輸出 -- ```! 5 100 1 5 25 ``` --- [查看我們在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-16-7" width="100%"></iframe> --- {%hackmd i1nMRrZcTFmTvoF897K9zg %}
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up