Check whether bitwise AND of N numbers is Even or Odd | C ++ implementation of the approach ; Function to check if the bitwise AND of the array elements is even or odd ; If at least an even element is present then the bitwise AND of the array elements will be even ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void checkEvenOdd ( int arr [ ] , int n ) { for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 == 0 ) { cout << " Even " ; return ; } } cout << " Odd " ; } int main ( ) { int arr [ ] = { 2 , 12 , 20 , 36 , 38 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; checkEvenOdd ( arr , n ) ; return 0 ; }