--- tags: DICE C --- 4-1 1個整數 === > [name=CHAWTeam] [time=Feb, 2022] --- 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) 上一篇:[3_8 自主學習](https://hackmd.io/@CHAWTeam/DiceC-3_8) 下一篇:[4-2 倒序](https://hackmd.io/@CHAWTeam/DiceC-4-2) --- 題目 --- ```! 寫一個程式,輸入一個整數,然後印出輸入的整數。 輸入範例: 5 輸出範例: 5 範例程式: #include <stdio.h> int main() { float num1,num2,num3; scanf(".....",......); printf("......\n",num1); return 0; } ``` ### 提示 ![提示](https://i.imgur.com/SZ8VeEi.png) 程式碼 --- ```c= #include <stdio.h> int main() { int num; scanf("%d", &num); //輸入變數 num 的數值 printf("%d", num); //印出變數 num 的數值 return 0; } ``` :::warning ```c= scanf("%d", &a); ``` `scanf` 函式要加上**取址運算子`&`**,否則編譯會出問題。 ::: 輸出 --- ```! 5 5 ``` --- [查看我們在HackMD上的所有筆記](https://hackmd.io/@CHAWTeam) 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) 上一篇:[3_8 自主學習](https://hackmd.io/@CHAWTeam/DiceC-3_8) 下一篇:[4-2 倒序](https://hackmd.io/@CHAWTeam/DiceC-4-2) --- {%hackmd Iiu5mOixR7yWkPHKCkabBg %} <iframe class="LikeCoin" height="235" src="https://button.like.co/in/embed/chawteam/button?referrer=https://hackmd.io/@CHAWTeam/DiceC-4-1" 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