Originally posted on Programming Praxis:

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.

The hello program is simple:

(define (hello)
  (display "Hello, world!")
  (newline))

The temperature conversion table isn't much harder. We follow K&R by using a do-loop and calculating the celsius temperature in-line instead of in…

View original 65 more words

About these ads