In this video, we're going to test the algorithm that we just wrote.

We're going to be counting from zero to N and N as a variable.

We're going to draw boxes for each of our variables to keep

track of what value they currently have as we step through our algorithm.

As we begin, N has the value, five.

The other thing we're going to keep track of is the output of our program.

Here is a box labeled, output,

and every time we write something down,

we're going to write it into this output box.

Finally, we're going to use a green arrow to keep track of where we are.

Right now, the arrow is right before the line that says count from zero to N,

which means we haven't done this yet. Now, we can start.

The first thing we want to do is count from zero to N inclusive,

and call each number that we're counting, i.

Since i is a variable,

and it's going to start with the value zero,

we create a box to hold i and its value of zero.

Now, we enter the next step.

The next thing we're going to do is write down N squared minus two times i.

We have a little bit of math to do here.

N is the value, 5,

and i has the value, zero,

so this gives us 25 minus zero or 25.

And again, we're supposed to write this number down,

so we place this number into our output box.

Now, this process is going to repeat again and again.

Now, i is going to have the value one.

Once again, we're going to compute N squared minus two times i.

This is the same as last time except i has the value of one.

This is 25 minus two or 23.

We write that to our output box.

Now, we just completed i equals zero,

and i equals one,

and we're trying to get all the way to i equals five.

So now, we're working on i with a value of two.

Once again, N squared minus two times i,

which is 25 minus four,

the value is 21, and we will write this to our output box.

Now, we're working on i with the value of three.

We're going to write down the number,

N squared minus two times i,

25 minus 6 which is 19,

into our output box.