It should be respond to all condition.
Really? To respond to all possible conditions will require infinite time. I am not willing to wait that long.
Please be realistic. You have shown several possibilities:
a[i]/constant
a[i] - a[j]
a[i] + a[j]
a[i]-constant
and comparisons >, <, or = to constants.
That is a much smaller (although still very large) set of conditions.
The size of the array is probably irrelevant because an autoindexing for loop will handle any size array.
How will you (or your users) specify which conditions they want to test? How will the constants be entered?
Is there a formula to calculate the value of j for a given value of i? For example you mentioned a[2] - a[25] = 89. Is the next test a[3] - a[25] = 89. or a[3] - a[26] = 89, or something else? If both i an j increase, what do you do when the larger index reaches the end of the array?
Many of these things are easy to do, but we need to know exactly which ones you want to do.
Lynn