Sunday, 11 December 2011

Write a program to print fabonnaci series of given number input by user in c

#include
#include
main()
{
int f=0,f1=1,f2=0,n,i=0;
clrscr();
printf("Enter any value");
scanf("%d",&n);
while(i {
printf("%4d",f2);
f=f1+f2;
f1=f2;
f2=f;
i++;
}
getch();
}

OUTPUT

Enter any value: 5
0 1 1 2 3

No comments:

Post a Comment