采用VB编程:一个小球从100m高处自由落下,每次落地后反弹回原高度的一半再落下,求它在第10次落

2024-11-26 12:37:45
推荐回答(3个)
回答1:

   雀雹  顷拦帆   Dim 高度 As Double = 100, 次数 = 0, 总量 = 100, 最后反弹高 = 0

A:

        高度 = 高度 / 2

        总量 += 高度

        次数 += 1

        Console.WriteLine("{0} {1} {2}", 衡好次数, 总量, 高度)

        If 次数 < 10 Then GoTo A

回答2:

'采用VB编程:槐碧一个小球从100m高处自由落雹明散下,每次落地后源氏反弹回原高度的一半再落下,求它在第10次落地时,共经过多少米?第10次反弹多高?

Option Explicit

Private Sub Command1_Click()
Dim i As Long
Dim A As Double, B As Double, C As Double

A = 100 / 2
B = 100
For i = 2 To 10
B = B + A * 2
A = A / 2
Next i
MsgBox "第10次落地时经过" & Format(B, "0.######") & "米,第10次反弹高度" & Format(A, "0.######") & "米。"
End Sub
'答案
'299.609375
'0.097656

回答3:

dim i as integer , h ,s as object
s = 0
h = 100
for i = 1 to 10
s = s + h
h = h / 2
next i
textbox1.text = s
textbox2.text = h