<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # C 編程中的`if`語句 > 原文: [https://beginnersbook.com/2014/01/c-if-statement/](https://beginnersbook.com/2014/01/c-if-statement/) 當我們只在給定條件為真時才需要執行一個語句塊,那么我們使用`if`語句。在下一個教程中,我們將學習[ C `if..else`,嵌套`if..else`和`else..if`](https://beginnersbook.com/2014/01/c-if-else-statement-example/) 。 ## C - `if`語句 `if`語句的語法: `if`正文中的語句僅在給定條件返回`true`時才執行。如果條件返回`false`,則跳過`if`內的語句。 ```c if (condition) { //Block of C statements here //These statements will only execute if the condition is true } ``` ### `if`語句的流程圖 ![C-if-statement](https://img.kancloud.cn/0d/cd/0dcd5b5d2d2409266b2edc7ebaa3b461_400x400.jpg) ### `if`語句的示例 ```c #include <stdio.h> int main() { int x = 20; int y = 22; if (x<y) { printf("Variable x is less than y"); } return 0; } ``` **輸出:** ```c Variable x is less than y ``` ### 多個`if`語句的示例 我們可以使用多個`if`語句來檢查多個條件。 ```c #include <stdio.h> int main() { int x, y; printf("enter the value of x:"); scanf("%d", &x); printf("enter the value of y:"); scanf("%d", &y); if (x>y) { printf("x is greater than y\n"); } if (x<y) { printf("x is less than y\n"); } if (x==y) { printf("x is equal to y\n"); } printf("End of Program"); return 0; } ``` 在上面的示例中,輸出取決于用戶輸入。 輸出: ```c enter the value of x:20 enter the value of y:20 x is equal to y End of Program ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看