First of all, let's consider the total no: of 5-digit codes that can be formed : P1 P2 P3 P4 P5 are the positions of the code.
P1 can be taken by any of the 10 digits from 0 to 9, since 0 is also allowed in P1.
Similarly P2, P3, P4, & P5 can also be taken by any of the 10 digits, since repetition of digits is allowed.
So, the total no: of 5-digit codes that can be formed is 10x10x10x10x10 = 10^5
Since David wants to set his locker code so that digit 5 is not immediately followed by the digit 9, let's remove all such codes, in which 5 is immediately followed by 9, from the total.
When 5 takes P1 & 9 takes P2, the remaining positions : P3,P4, & P5: can be taken by any of the 10 digits i.e. 10x10x10 = 10^3 codes
Similarly, When 5 takes P2 & 9 takes P3, we get 10 ^ 3 codes
When 5 takes P3 & 9 takes P4, we get 10 ^ 3 codes
When 5 takes P4 & 9 takes P5, we get 10 ^ 3 codes
So, the total no: of codes in which 5 is immediately followed by 9 = 4 * 10^3
= 4000
Since David wants to exclude all such codes : (Total no: of codes) - (no: of codes in which 5 is immediately followed by 9 )
=> 10^5 - 4000
=> 96000
Hence, A is the answer