Strange output in a while loop(C language) : <p>i just started learning C and don't understand why does the code segment below output 30. And why it doesn't output a number each iteration.</p>

<pre><code>int k=3, f=3;
while (k&lt;10)
     K++;
     f*=k;
printf("%d", f);
</code></pre>

<p>And when added curly braces it outputs 1814400, which in my opinion is the correct output</p>

<pre><code>int k=3, f=3;
while (k&lt;10){
     K++;
     f*=k;
}
printf("%d", f);
</code></pre>

<p>Could you explain why outputs are different? </p>
