shell指令碼的基本演算法編程

來源:互聯網
上載者:User

標籤:shell指令碼的基本演算法編程

第一題:斐波那契數列的遞迴與非遞迴

非遞迴:

650) this.width=650;" src="http://s1.51cto.com/wyfs02/M00/82/EF/wKiom1dl-8rD92igAAB-pImrC88891.png-wh_500x0-wm_3-wmp_4-s_582408408.png" title="數列非遞迴圖片.png" alt="wKiom1dl-8rD92igAAB-pImrC88891.png-wh_50" />

遞迴:

650) this.width=650;" src="http://s5.51cto.com/wyfs02/M00/82/EE/wKioL1dmAtGDO4NBAADA3Qh0kR0840.png-wh_500x0-wm_3-wmp_4-s_2210701244.png" title="遞迴圖片.png" alt="wKioL1dmAtGDO4NBAADA3Qh0kR0840.png-wh_50" />

注意在shell下return的範圍是0-255,在這不能用return1

第二題:字串截取cut

650) this.width=650;" src="http://s4.51cto.com/wyfs02/M02/83/00/wKioL1doloqwCEvpAABqPWtm1m8093.png-wh_500x0-wm_3-wmp_4-s_3006264771.png" title="字串截取.png" alt="wKioL1doloqwCEvpAABqPWtm1m8093.png-wh_50" />

第三題:求100個數的和

第一種非遞迴:

650) this.width=650;" src="http://s4.51cto.com/wyfs02/M01/83/01/wKiom1doma3gMPqOAAB1EPzrEaQ509.png-wh_500x0-wm_3-wmp_4-s_1076067697.png" title="求和非遞迴.png" alt="wKiom1doma3gMPqOAAB1EPzrEaQ509.png-wh_50" />

第二種遞迴

650) this.width=650;" src="http://s5.51cto.com/wyfs02/M02/83/01/wKioL1dopv_CuJktAABv4l07Yd4719.png-wh_500x0-wm_3-wmp_4-s_4142792152.png" title="求和遞迴.png" alt="wKioL1dopv_CuJktAABv4l07Yd4719.png-wh_50" />

第三種工具

650) this.width=650;" src="http://s2.51cto.com/wyfs02/M01/83/01/wKioL1dop3jiCWHbAAAck5VGulc203.png-wh_500x0-wm_3-wmp_4-s_1167999526.png" title="求和工具.png" alt="wKioL1dop3jiCWHbAAAck5VGulc203.png-wh_50" />

第四題:求三個數的最大值,最小值,平均值

650) this.width=650;" src="http://s2.51cto.com/wyfs02/M01/83/02/wKiom1dop7iw7htOAACLVaC7GTc429.png-wh_500x0-wm_3-wmp_4-s_1182994542.png" title="三個數的平均值,最大最小值.png" alt="wKiom1dop7iw7htOAACLVaC7GTc429.png-wh_50" />

shell指令碼的基本演算法編程

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.