the mass of the chocolate bar is 50 g.
we are told that 30 % of the bar consists of cocoa.
percentages are values given by a fraction of 100.
therefore for every 100 g of the chocolate bar, 30 g of the bar is cocoa.
so if 100 g of bar contains - 30 g cocoa
then 50 g of the bar contains -

therefore 15 g of the chocolate bar is cocoa