首页 > 其他 > 详细

Exercise: Loops and Functions (牛顿迭代法快速寻找平方根)

时间:2017-01-31 10:20:44      阅读:299      评论:0      收藏:0      [点我收藏+]

A Tour of Go

Exercise: Loops and Functions

https://tour.golang.org/flowcontrol/8

牛顿迭代法(简称“牛迭”)快速寻找平方根

技术分享

 

上面的程序求 10, 20, 30 ... 100 的平方根,运行结果如下:

技术分享

(括号里的数字是牛迭的循环次数,比如 5 表示循环了五次得出结果。)

 

参考:

https://nylira.com/a-tour-of-go-solutions/

https://gist.github.com/abesto/3476594

 

Exercise: Loops and Functions (牛顿迭代法快速寻找平方根)

原文:http://www.cnblogs.com/ahui2017/p/6358565.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!