This is the PocketC version of our combination
application. It's one of the Palm
You need PocketC (see tools section).
Below is the .c
file. For .bmp and
.prc, please download
the ZIP file.
int Factorial(int n)
if (n <= 1)
else return n*Factorial(n-1);
int Combination(int n, int p)
return Factorial(n)/(Factorial(n - p) * Factorial(p));
int n = 0, p = 0;
puts("Combination > Palm > PocketC\n\n");
n = gets("Value for 'n': ");
p = gets("Value for 'p': ");
puts("Factorial(" +n +") = " +Factorial(n) +"\n");
puts("Factorial(" +p +") = " +Factorial(p) +"\n");
puts("Factorial(" +(n-p) +") = " +Factorial(n-p) +"\n");
puts("Combination(" +n +"," +p +") = " +Combination(n,p) +"\n");
PocketC is a very valuable tool. They offer both a
mobile and a desktop version of their product, not only for Palm
but also for Pocket PC.
You have probably noticed that this version is sensibly
shorter than the C version with Palm SDK. Also, PocketC doesn't
need an extra file to describe the resources it uses. Those guys
are declared at the beginning of the .c
file, in the lines starting with @.
The core functions are located at the beginning of
the .c file: Factorial(),
Combination() and main().
Again, note that there is hardly any overhead, compared with the
Palm SDK version.