피보나치 수열 소스코드

From CS Wiki
Revision as of 01:33, 1 May 2018 by 221.153.37.97 (talk) (새 문서: == 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...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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)); 
}