How modulus operation works in C++? : <p>Why do I get this output: 0 1 2 3 0 1 2 3 0 1  after running the code below? Doesn't the modulus operation finds the remainder after division of one number by another? </p>

<pre><code>#include &lt;iostream&gt;
using namespace std;
int main ()
{
for (int i=0; i&lt; 10; ++i)
cout &lt;&lt; i % 4 &lt;&lt; " ";
}
</code></pre>
