How many elements does array "a" have? And how many times is the loop body executed, with which values for "i"? That's problem #1.
But there's a problem #2: The loop body doesn't just access element "i" of the array, it also accesses element "i+1".
And please
KeepItDown.