Ad

Examples:

sum of odd (0, 5) -> 0 + 3 + 5 -> 8
sum of odd (0, 9) -> 0 + 3 + 5 + 7 + 9 -> 24
sum of odd (5, 9) -> 5 + 7 + 9 -> 21
Code
Diff
  • const sumOdd = (min, max) => (++max / 2 | 0) ** 2 - (min / 2 | 0) ** 2;
    • sumNechet = (a, b) => (b/2).toFixed()**2;
    • const sumOdd = (min, max) => (++max / 2 | 0) ** 2 - (min / 2 | 0) ** 2;