Question: look the below program. When compiled it, the loop is not terminating. That is not an expected behaviour. Anyone please explain this reason?

```
#include<iostream.h>

int main()
{
    int nIntValue = 0;
    int nTempVal = 100;
    for( int nLoop = 1; nLoop <= 25; nLoop++ )
    {
        nTempVal = nTempVal / nLoop;
    }
    // Print the value of nIntVal
    while( nIntVal == 0 )
    {
        nIntVal += nTempVal;
        cout<<nIntVal;
    }
    return 0;
}

```

Answer: 
First of all, what is `nIntVal`?
Second, assuming its really `nIntValue`, when you enter the following loop:

```
while( nIntVal == 0 )
    {
        nIntVal += nTempVal;
        cout<<nIntVal;
    }

```

it is 0.

As for nTempVal, you are dividing 100 by `(1*2*3*...*25)`. You are using `int` type which means all values are rounded. But even if you didn't, the exact result of the first loop would be `0.000000000000000000000006447` which is pretty close to zero.

So both `nIntVal` and `nTempVal` are 0, and you are stuck here (0+0 = 0 and the loop never ends).
`nTempVal = 0`. So the loop is not terminated.

You can easily find such error with `debugger`