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 | #define _CRT_SECURE_NO_WARNINGS // ¼øȯÀûÀÎ ÆÑÅ丮¾ó ÇÔ¼ö °è»ê #include <stdio.h> int factorial(int n); int main(void) { int x = 0, result; printf("Á¤¼ö¸¦ ÀÔ·ÂÇϽÿÀ:"); scanf("%d", &x); result = factorial(x); printf("%d!Àº %dÀÔ´Ï´Ù.\n", x, result); return 0; } int factorial(int n) { printf("factorial(%d)\n", n); if (n <= 1) return 1; else return n * factorial(n - 1); } | cs |