Skip to content
UoL CS Notes

Pseudo Code - 2

COMP108 Lectures

This lecture follows through some examples of solving particular problems in pseudo code. The slides for this lecture are available here.

Factors of $x$ but Not Factors of $y$

In this example we find the factors of $x$ and $y$ and subtract the elements in the $y$ list from the $x$ list.

Lowest Common Multiple

This example iterates through all numbers until it finds one that satisfies mod = 0 for both numbers.

Using breaks in a loop is not a good practice as it diminishes readability.