/usr/share/doc/mathomatic/examples/intfact.c is in mathomatic 16.0.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /*
* Factorial function in C for positive integers.
*
* Return (arg!).
* Returns -1 on error.
*/
int
factorial(int arg)
{
int result;
if (arg < 0)
return -1;
for (result = 1; result > 0 && arg > 1; arg--) {
result *= arg;
}
if (result <= 0) /* return -1 on overflow */
return -1;
return result;
}
|