This is an open source platform. Create coding videos, upload them on YouTube, and help the community grow.
Teaching is the fastest way to learn β and the best way to never forget what you know π
Screen only
Screen With Camera
β‘Start Recording
Selected Template
Start Recording
Generating Thumbnail...
Difficulty:
function evenOrOdd(n) { return n % 2 === 0 ? "Even" : "Odd"; }
Explanation: If a number is divisible by 2, it is even; otherwise, it is odd.
β± O(1) | πΎ O(1)
class Solution { public String evenOrOdd(int n) { return n % 2 == 0 ? "Even" : "Odd"; } }
Explanation: Using modulo operator to determine even or odd.
def even_or_odd(n): return "Even" if n % 2 == 0 else "Odd"
Explanation: Modulo operation checks divisibility by 2.
Solve using editor β