12,078,070 members (46,753 online)
Rate this:
See more:
Dim s, temp As String
Dim a, b, c As Long

a = CLng(Val(TxtBoxInput.Text))
s = TxtBoxInput.Text
TxtBoxInput.Clear()
For i = 1 To Len(s) Step 1
b = CLng(Mid(s, i, 1))
c = Len(s) - i
b = CLng(Val(b) * (2 ^ c))
temp = CStr(Val(temp) + b)
Next i

MessageBox.Show(temp)
Posted 18-Apr-13 18:58pm

Wrong approach to learning anything. Do you understand that the notion "explain" is not something defined? Without knowing of your background, it could range from a whole book starting from explaination what a variable means (declaration, initialization, type...) to just few words.

Also, imagine if everyone will try to pull every stupid piece of code from the Web and ask for explanation. The code should be explained only by its author. And you can ask only on the code you are trying to write.

—SA

Rate this:

## Solution 1

Set up some variables
make a = a number = whatever was typed into the text box
make s = the text from the text box
clear the text box
for each character in the text box
set b = that character
set c = the length of the original string less the position within the string that we're looking
calculate b = b ^ c (i.e. b to the power of c)
concatenate b to the end of temp

So it takes a number, and for each digit calculates its value to the power of its position from teh right of the number, and wriutes that out as a new number

e.g

input 123

output ...
1 ^ 3 + 2 ^ 2 + 3 ^ 1

= 1 + 4 + 3
= 8

Top Experts
Last 24hrsThis month
 Richard MacCutchan 400 Richard Deeming 280 Dave Kreskowiak 275 CHill60 200 OriginalGriff 195
 Dave Kreskowiak 3,101 OriginalGriff 3,010 Richard MacCutchan 2,574 CPallini 1,722 CHill60 1,579