# 20220630回家的一些釐清 ## for/while/if的使用時機 以下有手寫部分字醜見諒==|||![](https://i.imgur.com/zH7TKL4.png) ```c= /*印出1~9三次 表示奇偶*/ #include <stdio.h> int main() { int x; //先宣告一個會加一的數字 int c = 1; //計數器 while (c < 4) { printf("第%d次\n", c); for (x = 1; x < 10; x++) { if (x % 2 != 0) { printf("這是奇數%d\n", x); } else { printf("這是偶數%d\n", x); } } c++; } } ``` - 為甚麼for不常包while - [迴圈控制的功能](https://cpp.enmingw32.dev/cheng-shi-ru/quan-kong-zhi/quan-kong-zhi-zhi-ling) ## 怎麼畫流程圖(小豆丁等級) ※猜數字不小心擦掉後方條件,這是只能猜10次的猜數字遊戲 ![](https://i.imgur.com/eZkt7NT.png) ![](https://i.imgur.com/XGrPoIN.png)