Sunday, 8 January 2012

fabonacci series


#include<stdio.h>
#include<conio.h>
main()
{
int a,b;
long int c,d=0,e=1,f,a;
clrscr();
printf("\nenter the number");  /*Here as we use c=d+e as the value of d is 0 and value of
scan("%d",&a);          // e is 1 .d=e is to assign the value e to d.e=c is used to
          // assign the value of c to e. */
//scanf("\n%d",&a);
for(b=0;b<=a;b++)             //c=d+e
{                              //0=0+1//explain
c=d+e;                         //c=1
d=e;                           //d=e//e=1 and //d is blank d=1
e=c;                           //

printf("%ld\n",d);
}
getch();
return 0;
}

No comments:

Post a Comment