The First Two Programs

September 7, 2012

In their book The C Programming Language, Brian Kernigan and Dennis Ritchie say that the first program every programmer should write is a program that writes “Hello, world!” to the console. Then they give the second program that produces a fahrenheit/celsius temperature conversion table, with fahrenheit temperatures every 20 degrees from 0 to 300 and the corresponding celsius temperature to the nearest degree, each pair written on its own line with the two temperatures separated by tabs.

Your task is to write the first two programs. 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.

[…] doing, right? This time we have another two problems from Programming Praxis, aptly title “The First Two Problems“. The whole thing is based on the idea from Brian Kernighan and Dennis Ritchie that the first […]

I think I may have overdone it. The problem was easy enough, so I decided to make it a bit harder by drawing the characters to the screen using turtle graphics rather than just printing them. The lion’s share of the time was spent actually making the font, but I think it turned out relatively well.