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

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # C 程序:兩個浮點數相乘 > 原文: [https://beginnersbook.com/2017/09/c-program-to-multiply-two-floating-point-numbers/](https://beginnersbook.com/2017/09/c-program-to-multiply-two-floating-point-numbers/) 程序將兩個浮點數相乘并將乘積顯示為輸出。 ## 示例 1:顯示兩個浮點數乘積的程序 在該程序中,要求用戶輸入兩個浮點數,程序將輸入的值存儲到變量`num1`和`num2`中。然后程序將輸入的數字相乘并將乘積顯示為輸出。 ```c #include <stdio.h> int main(){ float num1, num2, product; printf("Enter first Number: "); scanf("%f", &num1); printf("Enter second Number: "); scanf("%f", &num2); //Multiply num1 and num2 product = num1 * num2; // Displaying result up to 3 decimal places. printf("Product of entered numbers is:%.3f", product); return 0; } ``` 輸出: ```c Enter first Number: 12.761 Enter second Number: 89.23 Product of entered numbers is:1138.664 ``` ## 示例 2:使用函數將兩個數相乘的程序 在這個程序中,我們創建了一個用戶定義的函數`product()`,它在函數調用期間將我們傳遞給它的數字相乘。此函數返回這些數字的乘積。要了解該程序,您應該具備以下 [C 編程](https://beginnersbook.com/2014/01/c-tutorial-for-beginners-with-examples/)概念的知識: 1. [C - 函數](https://beginnersbook.com/2014/01/c-functions-examples/) 2. [C - 按值調用函數](https://beginnersbook.com/2014/01/c-function-call-by-value-example/) ```c #include <stdio.h> /* Creating a user defined function product that * multiplies the numbers that are passed as an argument * to this function. It returns the product of these numbers */ float product(float a, float b){ return a*b; } int main() { float num1, num2, prod; printf("Enter first Number: "); scanf("%f", &num1); printf("Enter second Number: "); scanf("%f", &num2); // Calling product function prod = product(num1, num2); // Displaying result up to 3 decimal places. printf("Product of entered numbers is:%.3f", prod); return 0; } ``` 輸出: ```c Enter first Number: 12.761 Enter second Number: 89.23 Product of entered numbers is:1138.664 ``` 查看這些相關的 [C 程序](https://beginnersbook.com/2015/02/simple-c-programs/): 1. [C 程序:相加兩個數字](https://beginnersbook.com/2017/09/c-program-to-add-two-numbers/) 2. [C 程序:打印用戶輸入的整數](https://beginnersbook.com/2017/09/c-program-to-print-an-integer-entered-by-a-user/) 3. [C 中的`Hello World`程序](https://beginnersbook.com/2017/09/c-hello-world-program/) 4. [C 程序:查找給定范圍內的回文數](https://beginnersbook.com/2015/02/c-program-to-find-palindrome-numbers-in-a-given-range/) 5. [C 程序:將小寫字符串轉換為大寫](https://beginnersbook.com/2015/02/c-program-to-convert-lowercase-string-to-uppercase-string/)
                  <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>

                              哎呀哎呀视频在线观看