40 lines
434 B
C
40 lines
434 B
C
#include <stdio.h>
|
|
|
|
int fib(int n){
|
|
if(n== 0 || n==1){
|
|
return 1;
|
|
}
|
|
return fib(n-1) + fib(n-2);
|
|
}
|
|
|
|
int main(){
|
|
int num[15], i;
|
|
|
|
for(i=0;i<15;i++){
|
|
num[i] = fib(i);
|
|
}
|
|
|
|
for(i=0;i<15;i++){
|
|
printf("%d ", num[i]);
|
|
}
|
|
printf("\n");
|
|
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
int main(){
|
|
int num[15] = {1, 1}, i;
|
|
|
|
for(i=2;i<15;i++){
|
|
num[i] = num[i-1] + num[i-2];
|
|
}
|
|
for(i=0;i<15;i++){
|
|
printf("%d ", num[i]);
|
|
}
|
|
printf("\n");
|
|
|
|
return 0;
|
|
}
|
|
*/
|