Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Both in questions as well as in answers I frequently see code (for example an MWE) followed by the printed output that code produces, something I have never managed to achieve. How is this done?