aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/fact.c
blob: 1147d8fe59a2698c0e2d3991a07d0265c77954e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
int
fact(int x)
{
   int y = 1;
   while (x >= 1) {
      y *= x;
      x -= 1;
   }
   return y;
}

extern int printf();
int main() { printf("6! = %d\n", fact(6)); }