Parity of the given mathematical expression using given N numbers | C ++ program to determine the parity of the given mathematical expression ; Iterating through the given integers ; If any odd number is present , then S is even parity ; Else , S is odd parity ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void getParity ( int n , const vector < int > & A ) { for ( auto x : A ) { if ( x & 1 ) { cout << " Even " << endl ; return ; } } cout << " Odd " << endl ; } int main ( ) { int N = 3 ; vector < int > A = { 2 , 3 , 1 } ; getParity ( N , A ) ; return 0 ; }