26 lines
461 B
C
26 lines
461 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
int main() {
|
||
|
int x=0;
|
||
|
int y=1;
|
||
|
int z=1;
|
||
|
int n;
|
||
|
int i;
|
||
|
printf("Quel numero de terme voulez vous: ");
|
||
|
scanf("%d",&n);
|
||
|
if (n==0){
|
||
|
printf("Le terme 0 de le suite est %d",x);
|
||
|
} else{
|
||
|
if (i==1){
|
||
|
printf("Le terme 1 de la suite est %d",y);
|
||
|
} else{
|
||
|
for (i=2;i<n;i++){
|
||
|
x=y;
|
||
|
y=z;
|
||
|
z=x+y;
|
||
|
} printf("Le terme %d de la suite est %d\n",n,z);
|
||
|
}
|
||
|
}
|
||
|
return 0;
|
||
|
}
|