void CountDown(int n);
int main()
{
CountDown(4);
}
void CountDown(int n)
{
cout << "카운트 다운..." << n << endl;
if (n > 0)
CountDown(n - 1);
cout << n << ": Kaboom!" << endl;
}
실행 결과.

이런 재귀 함수의 재밌는 특징은, if 구문 이전의 코드는 순차적으로 진행되지만, 이후의 코드는 반대로 거슬러 올라간다는 점이다.
int Fibonacci(int n);
int main()
{
cout << Fibonacci(7) << endl;
}
int Fibonacci(int n)
{
if (n <= 2)
return 1;
return Fibonacci(n - 1) + Fibonacci(n - 2);
}
1,1,2,3,5,8,13....이렇게 이전의 두 숫자를 더한 값이 다음 값이 되는 피보나치 수열의 특징은 다중 재귀 함수로 구현하기 딱 알맞은 예제이다.