재귀적

int factorial(int n) {
	if (n > 0) return n * factorial(n - 1);
	else return 1;
}

재귀 호출

int gcd(int x, int y) {
	if (y == 0) return x;
	else return gcd(y, x % y);
}

재귀 알고리즘 분석

/*--- 재귀 함수 recur ---*/
void recur(int n) {
	if (n > 0) {
		recur(n - 1);
		printf("%d\n", n);
		recur(n - 2);
	}
}

//매개변수 n으로 4를 전달했을 경우

캡처.PNG