21 lines
369 B
C
21 lines
369 B
C
|
|
#include <stdio.h>
|
||
|
|
#include <stdlib.h>
|
||
|
|
|
||
|
|
int main(void) {
|
||
|
|
int u0=0,u1=1,utemp,nieme,terme;
|
||
|
|
printf("Donnez un entier : ");
|
||
|
|
scanf("%d",&nieme);
|
||
|
|
if (nieme==0)
|
||
|
|
printf("%d\n",u0);
|
||
|
|
else if (nieme==1)
|
||
|
|
printf("%d\n",u1);
|
||
|
|
else{
|
||
|
|
for (terme=2;terme<=nieme;terme++){
|
||
|
|
utemp=u0+u1;
|
||
|
|
u0=u1;
|
||
|
|
u1=utemp;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
printf("%d\n",u1);
|
||
|
|
return EXIT_SUCCESS;
|
||
|
|
}
|