Smallest Even Multiple

Given a positive integer n, return the smallest positive integer that is a multiple of both 2 and n.

Example 1
Inputn = 5
Output10
The smallest multiple of both 5 and 2 is 10.
Example 2
Inputn = 6
Output6
The smallest multiple of both 6 and 2 is 6 because a number is a multiple of itself.

Constraints

  • 1 <= n <= 150

Asked at 3 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate