
You are given a positive integer ‘N’. You have to check whether ‘N’ can be represented as a sum of two even numbers or not.
For example:If the given number is 6, The number 6 can be represented as 2 + 4, and both 2 and 4 are even numbers. Hence the answer is “YES”.
The first line of the input contains an integer, 'T,’ denoting the number of test cases.
The first line of each test case contains a single integer ‘N’, representing the given integer.
Output Format:
For each test case, print “YES” if ‘N’ can be represented as a sum of two even numbers. Otherwise, print “NO”.
Print the output of each test case in a separate line.
Note:
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 10^9
Time limit: 1 sec
2
16
11
YES
NO
For the first test case,
The number 16 can be represented as 10 + 6, and both 10 and 6 are even numbers. Hence the answer is “YES”.
For the second test case,
The number 11 cannot be represented as a sum of two even numbers. Hence the answer is “NO”.
2
44
2
YES
NO
The Sum of two even numbers is always even.
The intuition behind the approach is that the sum of two even numbers is always even.
Algorithm:
O(1).
All operations in this approach are taking constant time. Hence the overall time complexity is O(1).
O(1).
Constant space is being used. Hence, the overall space complexity is O(1).