Ninja wants to travel from his house to his best friend’s house. The houses are located on a 2D coordinate plane, with Ninja’s house being situated at the origin. Ninja’s friend’s house is located somewhere on the x-axis. Now bombs are located at every point with an odd x-coordinate. Ninja can reach his friend’s house if it is an even coordinate else, he cannot reach there because there is a bomb placed at that point. There is a dragon who doesn’t let ninja use, modulus operator.
You are given an integer ‘N’ denoting the x-coordinate of Ninja’s friend’s house. Can Ninja reach his friend’s house? If yes, then return 1 else, return 0. Can you help him find without using the modulus operator?
Input Format:
The first line contains ‘T’, denoting the number of test cases.
Each test case contains a single integer ‘N’, denoting the x-coordinate of Ninja’s friend’s house.
Output Format:
For each test case, return '1' if Ninja can reach his friend’s house else return '0'.
Note:
You cannot make use of the modulus operation.
You are not required to print the expected output; it has already been taken care of.
Just implement the function.
Constraints:
1 <= T <= 10
1 <= N <= 10^9
Time Limit: 1 sec