PHP簡單一實例

來源:互聯網
上載者:User

標籤:

<?php/** * @author admin * @copyright 2016 *編程實現2+4+6+…+100。 *$sum = 0;for($i=2;$i<=100;$i+=2){    $sum+=$i;}echo $sum;*//** *編程實現1*3*5*7*9*11.  * $sum = 1;for($i=1;$i<=11;$i+=2){    $sum*=$i;}echo $sum;*//** *編程實現如下:100 99 98 97 9695 94 93 92 9190 89 88 87 8685 84 83 82 8180 79 78 77 7675 74 73 72 7170 69 68 67 6665 64 63 62 6160 59 58 57 5655 54 53 52 5150 49 48 47 4645 44 43 42 4140 39 38 37 3635 34 33 32 3130 29 28 27 2625 24 23 22 2120 19 18 17 1615 14 13 12 1110 9 8 7 65 4 3 2 1. */ for($i=100;$i>=1;$i--){    echo $i.‘ ‘, --$i.‘ ‘, --$i.‘ ‘, --$i.‘ ‘, --$i.‘ ‘;    echo "<br>";}?>

 

PHP簡單一實例

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.