In the program below, y is a positive integer (e.g., 1, 2, 3, ...).
What is the value of result after running the program?
A good way to do this problem would be to try a value for y, such as 5. Running the program:
We will repeat the following procedure 3 times:
For 5 times, we will add 1 to the result.
0+1+1+1+1+1=5
Doing this two more times will result in:
5+1+1+1+1+1=10
10+1+1+1+1+1=15
So when y=5, we obtain a value of 15, implying 3y.