We can try for loops along with conditional statements to get the indices of the needed numbers.
Zero-based indexing indexes the elements of an array or such container starting from 0, instead of starting from 1 (which is what we usually do in real life).
For this case, assuming we want to write code in python, and array being simple list, plus we want the index of only first two numbers found which add up to the target, we have:
for idx_1 in range(len(arr)//2 + 2):
num_1 = arr[idx_1]
found = 0
for idx_2 in range(idx_1 + 1, len(arr)):
num_2 = arr[idx_2]
if target == num_1 + num_2:
print(idx_1, idx_2)
found = 1
break
if found: break
Here we used 'range' function for first loop, which defaulty generates integers from 0, but can generate integers from whatever integer. Like in the second loop, it generates number from idx_1 + 1. Also, it doesn't include the last integer, given by the upper limit for the range.
This python code gives the indices of a pair of two numbers from the array given which adds up to the target.
Thus, we can try for loops along with conditional statements to get the indices of the needed numbers.
Learn more about zero-based indexing here:
https://brainly.com/question/16231522
#SPJ1