Fibonacci numbers:Each Fibonacci numbers is defined to be the sum of its two immediate previous terms, where as the first two number are 0 and 1.
The Fibonacci numbers are the numbers in the following integer sequence :
0 1 1 2 3 5 8 13 21 34 55 89 144. . . . .
/*Programme to print Fibonacci numbers less than given user number*/
#include<stdio.h>#include<conio.h>
int main()
{
int x,y,z,num;
printf("Enter any last number of Fibonacci series : ");
scanf("%d",&num);
x=0;
y=1;
while(num>=x)
{
z=x+y;
z=x+y;
printf("%d\t",x);
x=y;
y=z;
}
getch();
getch();
return 0;
}
Output of above program :
Enter last number where goes to end Fibonacci series : 70
0 1 1 2 3 5 8 13 21 34 55
Related Programs:
it is very use full site ... i undershould easily and everything ...
ReplyDeletei need algorithm for this program
ReplyDeleteyour code is little wrong ,it should be z in the printf("%d\t",z) not like this printf("%d\t",x)
ReplyDeleteits wrong then...u need to change it ..z instead of x ..
ReplyDeletei need c program to display 100 numbes
ReplyDelete