You have encountered here one of the numerous issues with slideshow presentations as a medium to communicate information. PowerPoint and similar tools are very tricky to impossible to use because of several limitations. Among them:
Small resolution (when you project the presentation into a wall, you can't use small fonts or detailed illustrations).
Separation of content into slides, where one and one only slide can be shown at the same time.
In your case, twenty lines of code may fit on a tiny little slide, but forty cannot. If your intention is to show small changes to a piece of code, you could illustrate those changes through a diff. However, from my understanding of your question, you're showing two rather distinct pieces of code, which means that a diff wouldn't be appropriate here.
In The Cognitive Style of PowerPoint, Edward R. Tufte suggests an alternative to slideshows that could work in your case: print the source code on paper, and distribute it to the participants at the beginning of the meeting/conference.
To make it easier to follow your talk and be able to compare the pieces of code:
Carefully pick a layout. In some cases, portrait would work better. In others, landscape is the best choice. For instance, if you need to show how a clever refactoring allowed you to go from twenty LOCs down to ten, landscape mode would work better in terms of visual comparison.
Always add the line numbers. Always. It is extremely annoying both for the person from the audience asking you the question and yourself to be here in front of thirty programmers to try to figure out what line of code the person is talking about. “No, I mean, not the first loop, but the line just before the condition in the second loop, no, not this one, but the one after that…”
Always use syntax highlighting (make sure you use a white background, however, to save ink).
When needed, don't hesitate to enrich the source code with arrows, legends, rectangles delimiting the zones of interest, etc.
Example of a decorated piece of code in a context of an explanation of why for and foreach are completely different constructs in C#. The digits in circles have the same role as line numbers: to be able to pinpoint a specific place in code.
