If we have a polynomial having n vertices then corresponding to each vertices we will have total (n-3) diagonals. ( By joining a vertex to every other vertices except its 2 neighbours. )
So total number of diagonal = n *(n-3)/2 ( Dividing by 2 because of duplicate diagonals ).
Here n= 8 for octagon,
No of diagonal = (8-3)*8/2 = 20
Ans- B