Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7278721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:54:48+00:00 2026-05-28T22:54:48+00:00

The Code has two options. Option one starts with 1 dollar and doubles everyday

  • 0

The Code has two options. Option one starts with 1 dollar and doubles everyday for 10 days. If this is correct the value should be $1024 but instead it shows double that ($2046)

The second option starts with $100 and adds $100 per day for 10 days. The number should come out to an even $1000 but instead shows $6500

Public Class Form1
    Private Sub compareButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles compareButton.Click

        Dim initValue1 As Integer = 1
        Dim value1 As Integer
        Dim initValue2 As Integer = 100
        Dim value2 As Integer

        Integer.TryParse(Option1TextBox.Text, value1)
        Integer.TryParse(Option2TextBox.Text, value2)



        For day As Integer = 1 To 10
            initValue1 = initValue1 * 2
            value1 += initValue1
        Next day

        Option1TextBox.Text = value1.ToString("C2")

        For day As Integer = 1 To 10
            initValue2 = initValue2 + 100
            value2 += initValue2
        Next day

        Option2TextBox.Text = value2.ToString("C2")

    End Sub
End Class

I feel like I am making a very small mistake. Any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T22:54:48+00:00Added an answer on May 28, 2026 at 10:54 pm

    Try this:

    No Need of value1 += initValue1 and value2 += initValue2 remove them and try

    Dim initValue1 As Integer = 1
            Dim value1 As Integer
            Dim initValue2 As Integer = 100
            Dim value2 As Integer
            Integer.TryParse(Option1TextBox.Text, value1)
            Integer.TryParse(Option2TextBox.Text, value2)
            For day As Integer = 1 To 9
                initValue1 = initValue1 * 2
            Next
            Option1TextBox.Text = initValue1.ToString("C2")
            For day As Integer = 1 To 9
                initValue2 = initValue2 + 100
            Next
            Option2TextBox.Text = initValue2.ToString("C2")
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the last two days, ive run across code that has php echo'd variables
So this code has the off-by-one error: void foo (const char * str) {
I've got two branches of code. 1 has a dialog box that the other
This code has an interesting bug: some_struct struct_array1[10] = {0}; some_struct struct_array2[10] = {0}
My code has something like this: HttpFileCollection files Instead of looping through each file
I have an app that has two buttons – one for email & one
This is two questions in one really... First, I have a list of 'tickets'.
I have a page that has two jqGrids on it. One contains a list
The code has a runtime dependency which is not available in our development environment
The following code has a simple binding which binds the Text of the TextBlock

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.