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

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # C 程序:查找數組的最大元素 > 原文: [https://beginnersbook.com/2015/02/c-program-to-find-largest-element-of-an-array/](https://beginnersbook.com/2015/02/c-program-to-find-largest-element-of-an-array/) 在下面的程序中,我們使用給定數組的第一個元素初始化變量(`max_element`),然后我們使用循環將該變量與數組的所有其他元素進行比較,每當我們得到一個值大于`max_element`的元素時,我們將該元素移動到`max_element`并使用相同的方法進一步移動以獲取數組中的最大元素。 ```c #include <stdio.h> /* This is our function to find the largest * element in the array arr[] */ int largest_element(int arr[], int num) { int i, max_element; // Initialization to the first array element max_element = arr[0]; /* Here we are comparing max_element with * all other elements of array to store the * largest element in the max_element variable */ for (i = 1; i < num; i++) if (arr[i] > max_element) max_element = arr[i]; return max_element; } int main() { int arr[] = {1, 24, 145, 20, 8, -101, 300}; int n = sizeof(arr)/sizeof(arr[0]); printf("Largest element of array is %d", largest_element(arr, n)); return 0; } ``` **輸出:** ```c Largest element of array is 300 ```
                  <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>

                              哎呀哎呀视频在线观看