human
Number of subarrays having even product | Function to count subarrays with even product.
Total number of subarrays.
Counter variables.
Traverse the array.
If current element is odd.
Update count of subarrays with odd product up to index i.
Print count of subarrays with even product.
Driver code.
Input.
Length of an array.
Function call to count even product subarrays"
Solution in Python:
 What is a code to number of subarrays having even product and the other steps required?
assistant
#Here is code to number of subarrays having even product and the other steps required.
 def evenproduct ( arr , length ) :
	total_subarray = length * ( length + 1 ) // 2
	total_odd = 0
	count_odd = 0
	for i in range ( length ) :
		if ( arr [ i ] % 2 == 0 ) :
			count_odd = 0
		else :
			count_odd += 1
			total_odd += count_odd
	print ( total_subarray - total_odd )
if __name__ == " _ _ main _ _ " :
	arr = [ 7 , 5 , 4 , 9 ]
	length = len ( arr )
	evenproduct ( arr , length )