Example : {3,12,4,7,10,8}, No => 22, So pair is {12,10}
No = 22
nums = [3,12,4,7,10,8]
Flag=0
for i in range(len(nums) - 1):
for j in range(i + 1, len(nums)):
if(nums[i] + nums[j] == No):
Flag=1
print('Pair: ', (nums[i], nums[j]))
if(Flag==0):
print('Pair not found')
Comments
Leave a comment