O Tannenbaum

December 24, 2013

Merry Christmas to all my readers.

Your task today is to write a program that draws a Christmas tree on the screen; it can be as simple or elaborate as you wish. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.


Pages: 1 2

4 Responses to “O Tannenbaum”

  1. Santa's Elf said

    In haskell, a nice little christmas tree.


  2. Santa's Gopher said

    Hacked up version in Go.

    Merry Christmas!

  3. warrior said

    After looking at other entries I feel I should have tried to spruce it up a bit ;).

  4. lmon said

    ConPHPigurable Tree:

    $rows = array(1,3,5,7,9,11,13,15,17,20,25,31,2,2,2);
    $cp = $rows;
    $wi = $cp[count($cp)-1];

    $char = “*”;
    foreach ($rows as $c) {
    $buff = round(($wi-$c)/2);
    print str_repeat ( ” ” , $buff );
    print str_repeat ( $char , $c );
    print “\n”;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: