티스토리 뷰

C/자료구조

C언어 기초 재귀(Recursive) 예제

j0n9m1n1 j0n9m1n1 2016.06.06 20:20

#include <stdio.h>


void Recursive(int num){


if(num <=0){


return;

}


printf("Recursive Call : %d\n", num);

Recursive(num - 1);

}


int main(){


Recursive(3);

return 0;

}


OUTPUT

Recursive Call : 3                                                                                            
Recursive Call : 2                                                                                            
Recursive Call : 1  


댓글
댓글쓰기 폼