19 lines
285 B
C
19 lines
285 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
int main(void){
|
||
|
int x = 0;
|
||
|
int i;
|
||
|
int y = 0;
|
||
|
int j = 1;
|
||
|
int temp;
|
||
|
printf("Rentrer un entier: ");
|
||
|
scanf("%d",&x);
|
||
|
for(i=1;i<=x;i++){
|
||
|
temp = y+j;
|
||
|
y=j;
|
||
|
j=temp;
|
||
|
}
|
||
|
printf("le %d terme de fibonacci est %d",x,y);
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|