Ask either guard what door the other guard would say is the exit, then choose the opposite door.
If you ask the guard who always tells the truth, he knows the other guard would lie, so he\’ll point you to the door leading to death. If you ask the guard who always lies, he knows the other guard would truthfully show you the exit, so he\’ll lie and point you to the door leading to death.
An alternate solution is to ask a guard what they would answer if you were to ask them which door was the exit, then choose that door. The truthful guard will point to the correct exit, but the lying guard will too. Here\’s why. If you asked him what door was the exit, he would normally lie and point to the death door, but you asked him what he would say if you asked what door was the exit, and in order to lie to that question, he will point you to the exit.