We have a content type named 'Q & A'. Go to Structure > Add Content > Q& A and nvaigate to Question text area section. Or click here.
Select the text format as FULL HTML.
Start typing the code in text area
Once you have started writing the code, click on Source option in editor toolbar,
Now edit the content by adding the tags <pre> and <code> .
After adding click on Source option in the toolbar to display the content normally, now you can see that the content is been highlighted
Double click the code section area, and you will get a popup for the code snippet, with the code content
Select appropriate language from the dropdown and add any code to code content section and click ok.
Code section will be highlighted like below once you save the whole content and publish the same.