16 lines
349 B
C
16 lines
349 B
C
#include <stdio.h>
|
|
|
|
int main(){
|
|
int fibo[20]={0};
|
|
int i;
|
|
fibo[0] = 0;
|
|
fibo[1] = 1;
|
|
float or[20]={0.};
|
|
for(i=2;i<=19;i=i+1){
|
|
fibo[i]=fibo[i-1]+fibo[i-2];
|
|
or[i]= (float) fibo[i]/fibo[i-1]; // (float)
|
|
}
|
|
printf("%d\n %f\n",i-1,or[i-1]); // attention i vaut 20 en sortant de la bouble!! et or[20] n'existe pas...
|
|
return(0);
|
|
}
|