--- tags: DICE C --- 3-2 加上一些形容詞 === > [name=CHAWTeam] [time=Feb 15, 2022] --- 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) 上一篇:[3-1 指定整數](https://hackmd.io/@CHAWTeam/DiceC-3-1) 下一篇:[3-3 指定浮點數](https://hackmd.io/@CHAWTeam/DiceC-3-3) --- 題目 --- ```! 寫一個程式,輸入一個指定的整數3,並加上一些詞,如輸出範例。 輸出範例: There are 3 cats. ``` 程式碼 --- ### 範例1 ```c= #include <stdio.h> int main() { int num; num = 3; printf("There are %d cats.", num); //「%d」為印出變數的位置 return 0; } ``` ### 範例2 ```c= #include <stdio.h> int main() { int num = 3; //也可以直接定義整數變數為 3 printf("There are %d cats.", num); //「%d」為印出變數的位置 return 0; } ``` :::success 輸入或輸出後的括號內,一樣要記得加上`""`,系統才會知道要印出指定字串。 ::: 輸出 --- ```! There are 3 cats. ``` --- [查看我們在HackMD上的所有筆記](https://hackmd.io/@CHAWTeam) 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) 上一篇:[3-1 指定整數](https://hackmd.io/@CHAWTeam/DiceC-3-1) 下一篇:[3-3 指定浮點數](https://hackmd.io/@CHAWTeam/DiceC-3-3) --- {%hackmd Iiu5mOixR7yWkPHKCkabBg %} <iframe class="LikeCoin" height="235" src="https://button.like.co/in/embed/chawteam/button?referrer=https://hackmd.io/@CHAWTeam/DiceC-3-2" 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