This is the PocketC version of our combination
You need PocketC (see tools section).
Below is the .pc
For .app (the executable
file) please download the ZIP
// Pocket PC
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;
putsl("Combination > Pocket PC > PocketC");
n = gets("Value for 'n': ");
p = gets("Value for 'p': ");
putsl("Factorial(" +n +") = " +Factorial(n));
putsl("Factorial(" +p +") = " +Factorial(p));
putsl("Factorial(" +(n-p) +") = " +Factorial(n-p));
putsl("Combination(" +n +"," +p +") = " +Combination(n,p));
Here comes PocketC again, if you've already read the
Palm section of our samples. Actually, the source code is exactly
the same as for Palm, except that you won't find the clauses starting
with @ that are used on Palm platform
to specify resources (like creator ID), and we're using putsl()
instead of puts()...
This version is sensibly shorter than the other versions
for Pocket PC.
The core functions are located at the beginning of
the .c file: Factorial(),
Combination() and main().