A common riddle-like question for programmers asks them to swap the values of two integers without a temporary intermediate value. There are two common solutions that I’m aware of, addition swap and XOR swap. Here’s what each looks like in C:
It’s very common for high-school students to learn the geometry of a circle.
Trigonometric functions (
cos(), etc.) are required knowledge for
high-school graduates, and they have a close relationship to circles. This means
that most students have seen the equation for a unit circle: