text: Print all distinct even and odd prefix Bitwise XORs of first N natural numbers | Print all distinct even & odd prefix Bitwise XORs from 1 to N ; Print the even number ; Print the odd number ; Driver Code
code: function evenOddBitwiseXOR ( N ) { document . write ( " " + 0 + " " ) ; for ( let i = 4 ; i <= N ; i = i + 4 ) { document . write ( i + " " ) ; } document . write ( " " ) ; document . write ( " " + 1 + " " ) ; for ( let i = 4 ; i <= N ; i = i + 4 ) { document . write ( i - 1 + " " ) ; } if ( N % 4 == 2 ) document . write ( N + 1 ) ; else if ( N % 4 == 3 ) document . write ( N ) ; } let N = 6 ; evenOddBitwiseXOR ( N ) ;