2012年11月5日 星期一

摺紙


一張紙0.5cm厚


對折

1次為1cm厚
2次為2cm厚
3次為4cm厚

地球至太陽距離為1億五千萬公里
試問要折幾次才能到達。

6 則留言:

  1. Dim distance As Double
    Dim ori As Double
    Private Sub Form_Load()
    ori = 0.5
    distance = 150000000000#
    i = 0

    Do
    ori = ori * 2
    i = i + 1
    Loop Until ori > distance

    Open App.Path & "\out.txt" For Output As #1
    Print #1, i
    Close #1
    End Sub

    回覆刪除
  2. Private Sub Form_Load()
    Me.Hide
    Open App.Path & "\out.txt" For Output As #1
    n = 0.5
    Do
    n = n * 2
    i = i + 1
    Loop Until n > 15000000000000#
    Print #1, i
    Close #1
    End
    End Sub

    回覆刪除
  3. Private Sub Form_Load()
    Me.Hide
    n = 0.5
    Do Until n >= Val(150000000000#)
    i = i + 1
    n = n * 2
    Loop
    Open App.Path & "\out.txt" For Output As #1
    Print #1, i
    Close
    End
    End Sub

    回覆刪除
  4. 復陞終點多一個0

    Bob & KiKi 程式正確

    回覆刪除
  5. Dim distance As Double
    Dim ori As Double
    Private Sub Form_Load()
    Me.Hide
    ori = 0.5
    distance = 150000000000#
    i = 0
    Do
    ori = ori * 2
    i = i + 1
    Loop Until ori > distance
    Open App.Path & "\out.txt" For Output As #2
    Print #2, i
    Close
    End Sub

    回覆刪除