This variation on the For Loop example shows how to use an array. An array is a variable with multiple parts. If you think of a variable as a cup that holds values, you might think of an array as an ice cube tray. It's like a series of linked cups, all of which can hold the same maximum value.
The For Loop example shows you how to light up a series of LEDs attached to pins 2 through 7 of the Arduino, with certain limitations (the pins have to be numbered contiguously, and the LEDs have to be turned on in sequence).
If you have to ask what a For Loop is then look on the first link, the Tutorials main page, for the For Loop example and learn from that. If some part of that is outside of your knowing then find the example on that.
I don't want to be a pain but there's books and sites that explain all these things clearly without someone having to write the same things perhaps not as completely or clearly here.
Either way, you have reading and practice to do, there is no USB-to-mind download.
If it's any consolation, everyone who knows the stuff had to go through a learning process that kind of never ends. If you think it's hard now, it was harder before the internet brought everything right to you. Back then I found that a nice Sam's or Que book let me learn faster than any classes.
As has been suggested, you do not need to use an array, 3 variables will do the job
set value1, value2 and X to zero
start of loop
set value1 equal to value2
set value2 equal to X
calculate the new value of X
if ((value1 == value2) && (value2 == X))
print X
end of if
end of loop
This method would be painful if you wanted to compare more than a couple of previous values, which is where an array would come in handy, but this will do for what you have described.