| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- baekjun
- til
- flask
- Sequential Search
- Counting cells in a blob
- 백준
- Numpy
- 10953
- 피보나치 수
- Daily Commit
- matrixElementsSum
- markdown
- codesingal
- 수 정렬하기
- adjacentElementsProduct
- 파이썬머신러닝완벽가이드
- almostIncreasingSequence
- 파이썬 포렌식
- cpp
- Python
- data_structure
- collections.deque
- C++
- centuryFromYear
- 2750
- codesignal
- All Longest Strings
- recursion
- 2015 봄학기 알고리즘
- shapeArea
Archives
- Today
- Total
Introfor
팩토리얼(반복, 재귀) 본문
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include<stdio.h> int main() { int num = 0, f = 1; scanf("%d",&num); if(num == 0) printf("%d",1); else{ for(int i = num; i>0; i--) f *= i; printf("%d",f); } } | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <stdio.h> int f(int n); int main() { printf("%d", f(5)); return 0; } int f(int n) { if (n == 1) return n; return n * f(n - 1); } | cs |
Comments