A man pays $1 to get into a gambling casino. He loses half of his money there and has to pay $1 to leave. He goes to a second casino and pays $1 to get in, he loses half his money again, and has to pay $1 to leave. Then, he goes to a third casino, pays another $1 to get in, loses half his money again, and pays $1 to leave. After this he's broke. ($0). Write a program to determine the amount of money he began with by testing $5, then $6, and so on.
Took me forever but I finally got it. This is the working code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
Dim x As Integer = 0
For y As Integer = 1 To Val(txtUserInput.Text) Step 1
x = 2 * x + 3
Me.lblOutput.Text = "He started out with $ " & x
But now I'm supposed to figure out this...
The guy goes in the first casino, pays $1, loses half his money, pays $1 to get out. Goes into a second casino, pays $2, loses half his money, pays $2 dollars to get in. Third casino- pay $3, lose half, pay $3 ect.
How do I find the code for this ><!