Question: I'm giving a small presentation to a group of C/C++ programmers who have very little experience with functional languages. Part of the presentation mentions Erlang, and I would like to give a specific small code example. 

There is a ton of awesome information on StackOverflow about how/where Erlang is used and its advantages. One of the most common advantages I see is how it can do a lot with just a little terse code, especially compared to C/C++. 

I am looking for a good code snippet of Erlang that simply illustrates these types of benefits. Especially something thats easily done in Erlang with few lines, that would be much more complicated in C/C++.

Anyone have any interesting suggestions?

Answer: 
Check out [example 4](http://www.erlang.org/doc/programming_examples/bit_syntax.html) for an excellent example of Erlang's bit syntax. I'm sure there are a number of c/c++ developers that will appreciate the brevity of the syntax!
Pythagorean Triples. Get all number combinations below 30 whereby the 3 numbers make a right angled triangle as it is according to Pythagoras.

```
[{X,Y,Z} || X <- lists:seq(1,30),
            Y <- lists:seq(1,30),
            Z <- lists:seq(1,30), ((X * X) + (Y * Y)) == (Z * Z)].

```

Try doing that in C/C++ , or Java and see if you will avoid a `for loop` if not more than one depending on your skill level :)