summaryrefslogtreecommitdiff
path: root/dbug/factorial.c
blob: 7b190ea8d8e91d63f7f5b7f4d8c145fe167c6eb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifdef DBUG_OFF				/* We are testing dbug */

int factorial(register int value) {
	if(value > 1) {
		value *= factorial(value-1);
	}
	return value;
}

#else

#include <my_global.h>

int factorial (
register int value)
{
    DBUG_ENTER ("factorial");
    DBUG_PRINT ("find", ("find %d factorial", value));
    if (value > 1) {
	value *= factorial (value - 1);
    }
    DBUG_PRINT ("result", ("result is %d", value));
    DBUG_RETURN (value);
}

#endif