2024-12-14 22:56:28 +00:00
|
|
|
#include "printf.h"
|
2024-12-07 20:02:32 +00:00
|
|
|
|
|
|
|
int fact(int n) {
|
|
|
|
if (n == 0)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return n * fact(n-1);
|
|
|
|
}
|
2024-12-06 22:40:52 +00:00
|
|
|
|
|
|
|
int main() {
|
2024-12-14 22:56:28 +00:00
|
|
|
int n = 8;
|
|
|
|
int res = fact(8);
|
|
|
|
|
|
|
|
printf("%d! = %d\n", n, res);
|
2024-12-06 22:40:52 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|