Assistance needed finding the result!

I’m taking a basic course in logical programming and the instructor asked us to find the result of the following routine:

int a;
int b;
int c;

a=100;
b=10;

for ( int x = 0; x < 5; x++ ) {
c=a*3+b+x;
}
MessageBox::Show (Convert::ToString (c));
...ummm...are you trying to say you don't understand it or something? Because it looks pretty simple to me...
If i'm not mistaken the result would be something like this:
it will show a message box with c=310, 311, 312, 313, 314 and then it will end the loop.
Is that correct firedraco?
I've never used the Convert or Messagebox, but your logic is definitely correct.

Since I've never used the convert I can't be sure, but wouldn't it only print the last value of the variable (314) since that's when the conversion was done?
The messagebox is outside the loop because it comes after the {}
But there is a semicolon missing.

So, the result should be 314 in a messagebox.

int main
Topic archived. No new replies allowed.