--- tags: DICE C --- 17-1 30內6的倍數 === > [name=CHAWTeam] --- 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) --- 題目 -- ```! 請撰寫一程式,印出1-30之間,所有6的倍數。輸出以換行隔開。 輸出範例: 6 12 18 24 30 C範例程式: #include <stdio.h> int main(){ int i=6; while(.........){ if(.............) printf("%d\n",i); i=i+1; } return 0; } C++範例程式: #include <iostream> int main() { int i=6; while(i<=30){ if(i%6==0) std::cout<<i<<"\n"; i=i+1; } return 0; } ``` 程式碼 -- ```c= #include <stdio.h> int main() { int i = 6; while (i <= 30) { if (i % 6 == 0) printf("%d\n", i); i++; } return 0; } ``` 輸出 -- ```! 6 12 18 24 30 ``` --- [查看我們在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-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