#include<stdio.h>
int factorial(int i) {
if (i == 1) return i;
return i * factorial(i - 1);
}
int main() { // scanf_s를 사용하려면 int형으로
int n;
scanf_s("%d",&n);
printf("%d \n", factorial(n));
return 0;
}
'개발정보 > DataStructure&Algorithm' 카테고리의 다른 글
02_Stack structure 응용_Maze Escape with Stack (0) | 2020.12.23 |
---|---|
01_Stack structure개념과 구현 (0) | 2020.12.22 |
시간복잡도 (0) | 2020.12.22 |
01_Recursive Call (Recalling oneself inside a function) (0) | 2020.12.20 |
댓글