I have database entry for password in md5 format, but when user uses the \"Forgot password\" then how can i give him/her the desired password?
You can't do that from an MD5 hash; nor should you be able to. Password recovery ought to be intractable.
The usual process is to send a password-reset token (URL) to their email address so that the user can choose a new password.