Run-error reason

I am getting run-error in the code submission. When we face the run-error?

Either the loop is not terminating or you are trying to access an array element that’s is invalid.
Like in array of ar[n] accessing ar[n] is not possible

I dont see any of the above mentioned conditions in the program. Can you please check once?