human
Sum and Product of minimum and maximum element of an Array | Function to find minimum element.
Function to find maximum element.
Function to get Sum.
Function to get product.
Driver Code.
Sum of min and max element.
Product of min and max element"
Solution in Python:
assistant
#Here is code to sum and Product of minimum and maximum element of an Array and the other steps required.
 def getMin ( arr , n ) :
	res = arr [ 0 ]
	for i in range ( 1 , n ) :
		res = min ( res , arr [ i ] )
	return res
def getMax ( arr , n ) :
	res = arr [ 0 ]
	for i in range ( 1 , n ) :
		res = max ( res , arr [ i ] )
	return res
def findSum ( arr , n ) :
	min = getMin ( arr , n )
	max = getMax ( arr , n )
	return min + max
def findProduct ( arr , n ) :
	min = getMin ( arr , n )
	max = getMax ( arr , n )
	return min * max
if __name__ == " _ _ main _ _ " :
	arr = [ 12 , 1234 , 45 , 67 , 1 ]
	n = len ( arr )
	print ( " Sum ▁ = ▁ " , findSum ( arr , n ) )
	print ( " Product ▁ = ▁ " , findProduct ( arr , n ) )