26 lines
376 B
C
26 lines
376 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
int main(void) {
|
||
|
int i;
|
||
|
int terme;
|
||
|
int resultat;
|
||
|
int nbr1 = 0;
|
||
|
int nbr2 = 1;
|
||
|
printf("Quel terme voulez vous ? :");
|
||
|
scanf("%d",&terme);
|
||
|
for (i = 0; i <terme+1;i++) {
|
||
|
if (i <= 1)
|
||
|
resultat = i;
|
||
|
else
|
||
|
{ resultat = nbr1 + nbr2;
|
||
|
nbr1 = nbr2;
|
||
|
nbr2 = resultat;}
|
||
|
}
|
||
|
printf("%d\n", resultat);
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|
||
|
|
||
|
|
||
|
|