For the above program, the final value stored in R

K = 0
R = 2259
WHILE R > 0
BEGIN
K = K +1
R =2258 - K*100
END
R = R + 55

For the above program, the final value stored in R is __________

When I ran this in a program I got 13, but someone else got 487.
Can anyone help me with the correct answer? Thank you
Only took 20 seconds to write this program. And I got the answer 13 as well, assuming it looks like this -

1
2
3
4
5
6
7
8
9
10
11
int K = 0;
int R = 2259;

while (R > 0)
    {
	  K = K + 1;
          R = 2258 - (K * 100);
    }
	  R = R + 55;

    std::cout << R << std::endl;
Topic archived. No new replies allowed.