Skip to the content of the web site.

Canadian Computing Competition

Example Programs

Below, you will find example programs for determining the factorial of a number (i.e., n! = n*(n-1)*...*3*2*1).

This example should be useful for the following reasons:

  • It gives a sense of how to handle input and output in various programming languages.
  • It gives a good sense of how long a program should be allowed to run.

Here are the sample programs:

The sample input file is input.txt.