After writing and running a simulation program for n number of times I realised that the switching actually increases the probability of winning. The winning probability after switching is 2/3. Obviously without switching it would be 1/3.
There are n internet resources giving solutions to this problem. My explanation for the problem is as below.
You choose a door. Probability of having car behind it is 1/3.
The host has two doors to open now. He knows what each door contains. They might contain following combinations
In all three cases the goat has to be there behind one of the doors. The host always invariably chooses to open the door that has a goat. If you notice above three combinations you notice that out of three cases he has in two cases the closed door will have a car.
So if you switch the probability of winning is 2/3.
People with mathematical disability might complain that this may not happen in practical situation but IT DOES HAPPEN and it must happen.