Count pairs with Bitwise OR as Even number | C ++ program to count pairs with even OR ; Count total even numbers in array . ; return count of even pair ; Driver main
#include <iostream> NEW_LINE using namespace std ; int findEvenPair ( int A [ ] , int N ) { int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) if ( ! ( A [ i ] & 1 ) ) count ++ ; return count * ( count - 1 ) / 2 ; } int main ( ) { int A [ ] = { 5 , 6 , 2 , 8 } ; int N = sizeof ( A ) / sizeof ( A [ 0 ] ) ; cout << findEvenPair ( A , N ) << endl ; return 0 ; }