피보나치 수열 소스코드: Difference between revisions

From IT Wiki
(새 문서: == C언어 == <syntaxhighlight lang="C" line='line'> #include <stdio.h> int fib(int n) { if(n<=1) return n; else return fib(n-1)+fib(n-2); } int main() { printf("%d", fib(3...)
 
No edit summary
Line 11: Line 11:
}
}
</syntaxhighlight>
</syntaxhighlight>
[[분류:알고리즘]]

Revision as of 13:04, 6 May 2018

C언어

#include <stdio.h>
int fib(int n) { 
  if(n<=1) return n; 
  else return fib(n-1)+fib(n-2);
} 

int main() { 
  printf("%d", fib(35)); 
}