[C#] Without using division to get a remainder - 116 ms beats 100%
\nusing System.Threading;\n\npublic class ZeroEvenOdd {\n    private readonly int _n;\n    private int _current = 1;\n    private readonly EventWaitHandle _even
```\nusing System.Threading;\n\npublic class ZeroEvenOdd {\n    private readonly int _n;\n    private int _current = 1;\n    private readonly EventWaitHandle _eventZero = new AutoResetEvent(true);\n    private readonly EventWaitHandle _eventEven = new AutoResetEvent(false);\n    private readonly EventWaitHandle _eventOdd = new AutoResetEvent(false);\n    private bool _oddNext = true;\n    \n    public ZeroEvenOdd(int n) {\n        _n = n;\n    }\n\n    public void Zero(Action<int> printNumber) {\n        while (_current <= _n) {\n            _eventZero.WaitOne();\n\n            if (_current <= _n) {\n                printNumber(0);\n            }\n            (_oddNext ? _eventOdd : _eventEven).Set();\n        }\n\n        _eventOdd.Set();\n        _eventEven.Set();\n    }\n\n    public void Even(Action<int> printNumber) {\n        while (_current <= _n) {\n            _eventEven.WaitOne();\n\n            if (_current <= _n) {\n                printNumber(_current++);\n            }\n            _oddNext = true;\n\n            _eventZero.Set();\n        }\n    }\n\n    public void Odd(Action<int> printNumber) {\n        while (_current <= _n) {\n            _eventOdd.WaitOne();\n\n            if (_current <= _n) {\n                printNumber(_current++);\n            }\n            _oddNext = false;\n\n            _eventZero.Set();\n        }\n    }\n}\n```
['C#']