I'm trying to find the sum of all the digits that make up the number 2^1000, which you may have guessed is from Project Eula. I think it's good so far except I'm just learning about arrays and dynamic arrays, so how will I know what the size of the index will be so I can specify when the Do loop should stop so I don't get an indexoutofrange exception?
vb.net Code:
  1. Dim BigNumber As Double = 2 ^ 1000
  2.         Dim DigitArray() As Char = BigNumber.ToString.ToCharArray
  3.         Dim Index As Integer = 0
  4.         Dim SumOfDigits As Integer = 0
  5.  
  6.         Do Until index
  7.             SumOfDigits += Integer.Parse(DigitArray(Index))
  8.             Index += 1
  9.         Loop
  10.  
  11.         TextBox1.Text = SumOfDigits.ToString