Penguin
Note: You are viewing an old revision of this page. View the current version.

Whenever I set about trying to learn a new programming language (very frequently) I often find myself stuck without simple exercises to do. I hope that if people add neat simple programming exercises here, it could be quite useful.

Greatest Common Divisor

"The oldest known nontrivial algorithm is Euclid's Algorithm for computing the greatest common divisor (gcd) of any two positive integers (300 B.C.). The idea of the algorithm is based om the observation that, gcd(a,b)=gcd(b,remainder(a,b)), and that gcd(x,0)=x."

Seems trivial? I agree, but it's a start.