--- tags: DICE C --- 6_3 發現不相等 === > [name=CHAWTeam] --- 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) 上一篇:[6-2 選偶數](https://hackmd.io/@CHAWTeam/DiceC-6-2) 下一篇:[6-4 輸出絕對值](https://hackmd.io/@CHAWTeam/DiceC-6-4) --- 題目 --- ```! 寫一個程式,輸入2個整數,判斷兩個數字是否相等。 如果兩數不相等,印出兩數不相等的運算式; 如果兩數相等,則印出兩數相等的運算式。 以下提供2種範例參考,你的輸出只會是其中一種: 輸入範例1: 2 9 輸出範例1: 2!=9 輸入範例2: 3 3 輸出範例2: 3==3 ``` ### 提示 ![](https://i.imgur.com/LD80W7n.png) 程式碼 --- ```c= #include <stdio.h> int main() { int a, b; scanf("%d %d", &a, &b); if (a == b) printf ("%d==%d\n", a, b); if (a != b) printf ("%d!=%d\n", a, b); return 0; } ``` 輸出 --- ```! 2 9 2!=9 ``` --- [查看我們在HackMD上的所有筆記](https://hackmd.io/@CHAWTeam) 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) 上一篇:[6-2 選偶數](https://hackmd.io/@CHAWTeam/DiceC-6-2) 下一篇:[6-4 輸出絕對值](https://hackmd.io/@CHAWTeam/DiceC-6-4) --- {%hackmd Iiu5mOixR7yWkPHKCkabBg %} <iframe class="LikeCoin" height="235" src="https://button.like.co/in/embed/chawteam/button?referrer=https://hackmd.io/@CHAWTeam/DiceC-6-3" 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