I observed a weird thing today in the Visual Studio IDE while solving the second question of Hourrank 25. This the the code.
On my local machine, the value of pre, automatically becomes 1 randomly anywhere inside the while loop. However, the weird thing is, if I initialise the value of fact to 0, then everything becomes normal again. This is weird because the computation of fact has nothing to do with the value of pre.
I feel silly asking this, but what am I missing? The code which is giving wrong answer on the local machine , gives the correct answer on Ideone, and also fetches full marks after submission.
Can someone please help.