44 lines
542 B
C
44 lines
542 B
C
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
int main(void) {
|
|
|
|
int reponse,ux, u1 = 1, u0 = 0,n = 2;
|
|
|
|
printf("Veuillez entrer votre n : ");
|
|
scanf("%d", &reponse);
|
|
|
|
if (reponse == 0)
|
|
{
|
|
printf("U de 0 est egale a 0\n");
|
|
return 0;
|
|
}
|
|
|
|
else
|
|
{
|
|
if (reponse == 1)
|
|
{
|
|
printf("U de 1 est egale a 1\n ");
|
|
return 0;
|
|
}
|
|
|
|
while (n != reponse)
|
|
{
|
|
ux = u0 + u1 ;
|
|
u0 = u1;
|
|
u1 = ux;
|
|
printf("n = %d, ux = %d , u0 = %d, u1 = %d\n",n ,ux ,u0, u1);
|
|
n++;
|
|
}
|
|
}
|
|
|
|
printf("U de %d est egal a %d\n",reponse,ux);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
}
|