1 Star 0 Fork 52

Palmworld/c2go

forked from Apocalypse/c2go 
Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
10.go 415 Bytes
Copy Edit Raw Blame History
ZenQy authored 2015-03-29 18:12 . last push
//一球从 100 米高度自由落下,每次落地后反跳回原高度的一半;再落下,
//求它在第 10 次落地时,共经过多少米?第 10 次反弹多高?
package main
import "fmt"
const COUNT = 10
func main() {
var high, sum float64 = 100, -100
for i := 0; i < COUNT; i++ {
sum += 2 * high
high /= 2
}
fmt.Println("The total of road is ", sum)
fmt.Println("The tenth is ", high, " meter")
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/imwinjune/c2go.git
git@gitee.com:imwinjune/c2go.git
imwinjune
c2go
c2go
master

Search

0d507c66 1850385 C8b1a773 1850385