<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # C 程序:檢查數字是偶數還是奇數 > 原文: [https://beginnersbook.com/2015/02/c-program-to-check-if-number-is-even-or-odd/](https://beginnersbook.com/2015/02/c-program-to-check-if-number-is-even-or-odd/) 如果一個數字可以被 2 整除,則它是偶數,否則它是一個奇數。在本文中,我們分享了兩種方式(兩個 C 程序)來檢查輸入數字是偶數還是奇數。 1)使用模數運算符(`%`)2)使用按位運算符。 #### 程序 1:使用模數運算符 ```c /* Program to check whether the input integer number * is even or odd using the modulus operator (%) */ #include<stdio.h> int main() { // This variable is to store the input number int num; printf("Enter an integer: "); scanf("%d",&num); // Modulus (%) returns remainder if ( num%2 == 0 ) printf("%d is an even number", num); else printf("%d is an odd number", num); return 0; } ``` **輸出:** ![checking_even_odd_modulus_cmd](https://img.kancloud.cn/ee/8a/ee8a5859f4ac7f156b9aed7d6e86bd81_533x236.jpg) #### 程序 2:使用按位運算符 ```c /* Program to check if number is even or odd * using bitwise operator */ #include<stdio.h> int main() { int n; printf("Enter an integer: "); scanf("%d",&n); if ( n & 1) printf("%d is an odd number", n); else printf("%d is an even number", n); return 0; } ``` **輸出:** ![checking_even_odd_bitwise](https://img.kancloud.cn/08/1a/081a00a178d745e637dd011af56f0c3d_533x236.jpg)
                  <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>

                              哎呀哎呀视频在线观看