### Interesting short code snippets

Posted:

**2023-May-15, 1:54 pm**I have a cool piece of C code to share with, you. This function does find the greatest common dividor using the well-known variant of Euclidean algorithm with division. The interesting thing is how it can be written using C while statement, conditional and assignment operators.
You can also share your interesting snippets of code, including one-liners, in this thread.

Code: Select all

```
int gcd (int a, int b) {
while ((a > b) ? (a %= b) : (b %= a));
return a | b;
}
```