7
Answers

Beginner problem

Josip Pavic

Josip Pavic

13y
2.7k
1
I now you would find this funny, but my problem is for loop. MessageBox display wrong result. cant figure out why??

                 int loopStart;
            int loopEnd;
            int answer = 0;

            loopStart = int.Parse(textBox1.Text);
            loopEnd = int.Parse(textBox2.Text);


            for (int i = loopStart; i < loopEnd; i++)
            {
                answer = answer + i;
            }

            MessageBox.Show(answer.ToString());


Thank for your help.
Jonny111
Answers (7)