If you find yourself stuck without simple exercises when trying to learn a new ProgrammingLanguage, try these. If you know a neat exercise that could stand to be mentioned here, please add it.


This is usually a very trivial program, but a good first exercise when learning how to use a new programming environment.


The TPK Algorithm is DonaldKnuth's HelloWorld. It doesn't actually do anything but it has an array, loop, conditional and function in it to make it exciting.

99 Bottles of Beer

Make your computer sing the 99 Bottles of Beer on the Wall song.

Very popular:

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 on the observation that, gcd( a, b ) = gcd( b, remainder( a, b ) ), and that gcd( x, 0 ) = x.

Seems trivial? Sure, but it's a start.

Compound Interest Calculator

Ward Numbers

See Wiki:WardNumberInManyProgrammingLanguages

A graph theory problem that looks convoluted enough to get very high-level languages sweating.

A ProgrammingLanguage

Writing/implementing ProgrammingLanguage will teach you that all the bugs, wrinkles and flaws in the languages you've ever used are there for a reason: ProgrammingLanguage design is challenging and ProgrammingLanguage implmentation is very hard and painstaking work. Plus, if you ever get it to the point where you have users, then they'll never comment on the 9/10s of the code that replicates what all the other languages do except to whine that it's not perfect.

Esoteric Interpreters

Wiki:EsotericProgrammingLanguages, like Brainf*ck, usually have small instruction sets and simple grammars. Interpreters for these languages aren't big programs but need a fair sample of a programming language's features to implement.

An example: befunge.a68, a Befunge interpreter in Algol 68 (the esoteric in the obscure).

A self compilation system

GCC is written in C. The Oberon system is written in Oberon. Writing a Compiler in the language it compiles is a great way to make sure you understand the language. The hard bit, of course, is the BootStrap.

Possible Projects

If you have an itch to start/work on a project, but can't think of anything to write, here are some possible ideas:

  • a GTK2 port/replacement of xtraceroute(1).
  • A decent bridge program for linux (with AI players so you can play offline)
  • AddToMe


lib/main.php:944: Notice: PageInfo: Cannot find action page

lib/main.php:839: Notice: PageInfo: Unknown action