According to the Dobereiner's triads pattern-
When the mass of first and last element is added and if that sum is divided by two, we get the mass of Middle element. This is considered as the average atomic mass of A and C will give the approximate mass of B.
So, A = 7, C = 39
=> B = ( A + C ) / 2
=> B = ( 7 + 39 ) / 2
=> B = 46 / 2
=> B = 23
Hence the atomic mass of B is 23.