We know that the value of g in the center of earth is zero(0). But applying the classical formula for calculating g: We find g=(GM)/0 which is undefined. So how can this be zero. I don't understand.
The acceleration due to gravity is only $g = G\, M / r^2$ when you are outside a sphere of mass $M$ (and at a distance $r$ from the center). When you are inside the sphere, that formula doesn't apply. Instead, you use the same formula with $M$ replaced by the amount of mass inside your radius.
If you think about the point at the precise center of the earth, just think about all the little pieces of earth that are pulling on that point. For each piece, there is an exactly equal piece on the opposite side from the center that is pulling the exact same amount, but in the opposite direction. So adding up the contributions from all those little pieces, you get a total of no acceleration.
You would expect this result in general because the acceleration has to accelerate you in some direction. Everywhere other than the center of the sphere, there's a natural choice for the direction in which you would be accelerated: towards the center. But at the center, there's no choice of direction that respects the spherical symmetry of the situation. The only acceleration that doesn't break the spherical symmetry is zero acceleration.
It turns out that the general formula for acceleration that works even inside the sphere of mass doesn't use the total mass $M$, but the portion of the mass that's at a radius less than $r$. This is called the Shell Theorem. It even works in general relativity, where it's called Birkhoff's Theorem
Of course, all of this is an idealization, as Martin points out in the comments. First of all, you have other objects around the Earth that alter the acceleration — the Moon, the Sun, the other planets, etc. Of course, even if you ignore all of them, the Earth itself is not spherically symmetric or even rotationally symmetric, so the "center" might not even have zero acceleration (depending on how you define center).