The important point to note here is all the odd numbers in binary form have 1 as their rightmost bit and all even numbers have 0 as their rightmost bit. The reason is simple all other bits other than the rightmost bit have even values and the sum of even numbers is always even. Now the rightmost bit can have a value of either 1 or 0 as we know even + odd = odd so when the rightmost bit is 1 the number is odd and when it is 0 the number is even. So to solve this problem we have to just check if a[r] is 0 or 1 and accordingly print odd or even
This article is contributed by Ayush Jha. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.