计算1+2+2的2次方+…+2的63次方的值,写出此算法的程序语句
问题描述:
计算1+2+2的2次方+…+2的63次方的值,写出此算法的程序语句
这是往试卷上答的,请规范些
答
结果是 1.84467440737096*10^19
Private Sub Command1_Click()
Dim sum As Double
Dim i As Integer
For i = 0 To 63
sum = sum + 2 ^ i
Next i
Debug.Print sum
End Sub