Prefix Product Array | Function to generate prefix product array ; Update the array with the product of prefixes ; Print the array ; Driver Code
def prefixProduct ( a , n ) : NEW_LINE INDENT for i in range ( 1 , n ) : NEW_LINE INDENT a [ i ] = a [ i ] * a [ i - 1 ] ; NEW_LINE DEDENT for j in range ( 0 , n ) : NEW_LINE INDENT print ( a [ j ] , end = " , ▁ " ) ; NEW_LINE DEDENT return 0 ; NEW_LINE DEDENT arr = [ 2 , 4 , 6 , 5 , 10 ] ; NEW_LINE N = len ( arr ) ; NEW_LINE prefixProduct ( arr , N ) ; NEW_LINE