Find the count of even odd pairs in a given Array | C # program to count the pairs in array of the form ( even , odd ) ; Function to count the pairs in array of the form ( even , odd ) ; Check if number is even or not ; Driver code
using System ; class GFG { static int findCount ( int [ ] arr , int n ) { int count = 0 , ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 == 0 ) { count ++ ; } else { ans = ans + count ; } } return ans ; } public static void Main ( ) { int [ ] a = { 5 , 4 , 1 , 2 , 3 } ; int n = a . Length ; Console . WriteLine ( findCount ( a , n ) ) ; } }