Given a non-negative integer n, check it's parity and return "even" or "odd"
A number is "even" if it is divisible by 2 and "odd" otherwise
Example:
Input: n = 12 Output: "even" Explanation: 12 is divisible by 2, so it is even
Hints:
You can make use of modulo operator with an if statement
12 % 2 is 0, therefore 12 is "even"
13 % 2 is 1, therefore 13 is "odd"
You can make use of modulo operator with an if statement
12 % 2 is 0, therefore 12 is "even"
13 % 2 is 1, therefore 13 is "odd"
Free plan: 30 tutor messages. Premium is unlimited.
Saved
Ctrl + Enter to check