human
Find the sum of all possible pairs in an array of N elements | Function to return the sum of the elements of all possible pairs from the array.
To store the required sum.
For every element of the array.
It appears ( 2 * n ) times.
Driver code"
Solution in Python:
assistant
#Here is code to find the sum of all possible pairs in an array of N elements and the other steps required.
 def sumPairs ( arr , n ) :
	sum = 0 ;
	for i in range ( n ) :
		sum = sum + ( arr [ i ] * ( 2 * n ) ) ;
	return sum ;
if __name__ == " _ _ main _ _ " :
	arr = [ 1 , 2 , 3 ] ;
	n = len ( arr ) ;
	print ( sumPairs ( arr , n ) ) ;