#include <stdio.h>
int main(){
/* declaration the variable */
int i_end; /* critical point */
int x = 0, y = 1, z = 0; /* initialize the tmp variable */
/* prompt */
printf("%s", "Enter the end number: ");
scanf("%d", &i_end);
/* Loop output the result */
while ( ( y + z ) < i_end ){ /* in advance make new third number + the second */
x = y; /* second number -> first number */
y = z; /* third number -> second number */
z = x + y; /* first + second = new third */
printf("%d ", z);
}
return 0;
}
Fibonacci
最新推荐文章于 2024-01-05 10:30:21 发布