(Sorry if this one has already been posted, it's fairly common)
Two spies are observing an enemy camp, looking for a way to get in. When it is dark, and the guard cannot recognize the men, he uses a code. One spy sneaks in close one night and overhears the guard talking to men as they come in.
Guard: The first number is 12, what is the second number?
Man: 6
Guard: You may enter
After several more minutes, another man approaches him
Guard: The first number is 6, what is the second number?
Man: 3
Guard: You may enter
The spy, thinking he has found out the code, approaches the guard
Guard: The first number is 10, what is the second number?
Spy: 5
The guard immediately pulls out a gun and kills the spy. It is up to you, the second spy, to figure out the code. What is it?