<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 程序:檢查阿姆斯特朗數 > 原文: [https://beginnersbook.com/2014/06/c-program-to-check-armstrong-number/](https://beginnersbook.com/2014/06/c-program-to-check-armstrong-number/) 如果數字的各位的立方和等于數字本身,則將數字稱為阿姆斯特朗數。在下面的 C 程序中,我們檢查輸入的數字是否是阿姆斯特朗數。 ```c #include<stdio.h> int main() { int num,copy_of_num,sum=0,rem; //Store input number in variable num printf("\nEnter a number:"); scanf("%d",&num); /* Value of variable num would change in the below while loop so we are storing it in another variable to compare the results at the end of program */ copy_of_num = num; /* We are adding cubes of every digit * and storing the sum in variable sum */ while (num != 0) { rem = num % 10; sum = sum + (rem*rem*rem); num = num / 10; } /* If sum of cubes of every digit is equal to number * itself then the number is Armstrong */ if(copy_of_num == sum) printf("\n%d is an Armstrong Number",copy_of_num); else printf("\n%d is not an Armstrong Number",copy_of_num); return(0); } ``` **輸出:** ```c Enter a number: 370 370 is an Armstrong Number ``` 您可以像這樣驗證結果: ```c 370 = 3*3*3 + 7*7*7 + 0*0*0 = 27 + 343 + 0 = 370 ``` 如您所見,數字 370 的各位立方和等于數字本身。
                  <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>

                              哎呀哎呀视频在线观看