~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to dbug/factorial.c

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifdef DBUG_OFF                         /* We are testing dbug */
 
2
 
 
3
int factorial(register int value) {
 
4
        if(value > 1) {
 
5
                value *= factorial(value-1);
 
6
        }
 
7
        return value;
 
8
}
 
9
 
 
10
#else
 
11
 
 
12
#include <my_global.h>
 
13
 
 
14
int factorial (
 
15
register int value)
 
16
{
 
17
    DBUG_ENTER ("factorial");
 
18
    DBUG_PRINT ("find", ("find %d factorial", value));
 
19
    if (value > 1) {
 
20
        value *= factorial (value - 1);
 
21
    }
 
22
    DBUG_PRINT ("result", ("result is %d", value));
 
23
    DBUG_RETURN (value);
 
24
}
 
25
 
 
26
#endif
 
27