Maximum possible elements which are divisible by 2 | Function to find maximum possible elements which divisible by 2 ; To store count of even numbers ; All even numbers and half of odd numbers ; Driver code ; Function call
def Divisible ( arr , n ) : NEW_LINE INDENT count_even = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT if ( arr [ i ] % 2 == 0 ) : NEW_LINE INDENT count_even += 1 NEW_LINE DEDENT DEDENT return count_even + ( n - count_even ) // 2 NEW_LINE DEDENT arr = [ 1 , 2 , 3 , 4 , 5 ] NEW_LINE n = len ( arr ) NEW_LINE print ( Divisible ( arr , n ) ) NEW_LINE