n down to 1 and put operators between neighbours in a repeating cycle: *, /, +, -, then *, /, +, - again, and so on. For n = 7 this gives 7 * 6 / 5 + 4 - 3 * 2 / 1.
The expression follows the usual precedence: multiplication and division first, left to right, then addition and subtraction. Division is integer division rounded down: 7 * 6 / 5 = 42 / 5 = 8.
Return the value of the expression for the given n.n=5 → 7
5 * 4 / 3 + 2 - 1: first 5 * 4 = 20, then 20 / 3 = 6 (rounded down), then 6 + 2 - 1 = 7.
n=9 → 11
9 * 8 / 7 + 6 - 5 * 4 / 3 + 2 - 1 = 10 + 6 - 6 + 2 - 1 = 11.
n=2 → 2
The expression is just 2 * 1.
n=5
7
Run checks the first 3 tests in your browser. Submit checks all 41 tests on the server, hidden ones included.