DEV/DEV1.1/TP05/fibbo.c
2022-10-04 17:30:38 +02:00

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