<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/2017/09/c-program-to-convert-decimal-number-to-binary-number/](https://beginnersbook.com/2017/09/c-program-to-convert-decimal-number-to-binary-number/) 該程序將十進制數轉換為等效的二進制數。 ## 示例:將十進制轉換為二進制的程序 在這個程序中,我們創建了一個用戶定義函數`decimalToBinary()`,用于十進制到二進制轉換。程序將十進制數(由用戶輸入)作為輸入,并使用函數`decimalToBinary()`將其轉換為二進制數。要理解這個程序,你應該有一下 [C 編程](https://beginnersbook.com/2014/01/c-tutorial-for-beginners-with-examples/)主題的基本概念: 1. [C - 函數](https://beginnersbook.com/2014/01/c-functions-examples/) 2. [C - `while`循環](https://beginnersbook.com/2014/01/c-while-loop/) ```c #include <stdio.h> #include <math.h> long decimalToBinary(int decimalnum) { long binarynum = 0; int rem, temp = 1; while (decimalnum!=0) { rem = decimalnum%2; decimalnum = decimalnum / 2; binarynum = binarynum + rem*temp; temp = temp * 10; } return binarynum; } int main() { int decimalnum; printf("Enter a Decimal Number: "); scanf("%d", &decimalnum); printf("Equivalent Binary Number is: %ld", decimalToBinary(decimalnum)); return 0; } ``` 輸出: ```c Enter a Decimal Number: 234 Equivalent Binary Number is: 11101010 ``` 看看這些相關的 C 程序: 1. [C 程序:將十進制轉換為八進制數](https://beginnersbook.com/2017/09/c-program-to-convert-decimal-to-octal-number/) 2. [C 程序:將八進制轉換為十進制數](https://beginnersbook.com/2017/09/c-program-to-convert-octal-number-to-decimal-number/) 3. [C 程序:將八進制數轉換為二進制數](https://beginnersbook.com/2017/09/c-program-to-convert-octal-number-to-binary-number/) 4. [C 程序:將二進制轉換為八進制數](https://beginnersbook.com/2017/09/c-program-to-convert-binary-to-octal-number-system/) 5. [C 程序:將二進制數轉換為十進制數](https://beginnersbook.com/2015/02/c-program-to-convert-binary-number-to-decimal-number/)
                  <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>

                              哎呀哎呀视频在线观看